HttpClient使用技巧
🎨

HttpClient使用技巧

设置类

设置请求执行记录显示在service tab中.

notion image
notion image

附件上传示例

### # @no-log POST https://staging-app.creams.io/api/web/incomes/verify-amount/import Content-Type: multipart/form-data; boundary=WebAppBoundary Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsiT0F1dGgyIiwiQkFTRV9VU0VSX0lORk8iLCJDUkVBTVMiXSwib3Blbl9pZCI6ImNyZWFtc281Y2RjZGY2ZjlhYjU0ZThkYjlmM2E5OGFhYTFkZmQ1MSIsInVzZXJfbmFtZSI6ImNyZWFtc243MjZmZGJmMjdlZjQ0ZWZlOGNlMjhlMzZkYjExZWFiYyIsInNjb3BlIjpbIkNSRUFNUyJdLCJ1bmlvbl9pZCI6ImNyZWFtc3U5OTVhOGY4NmNkZTA0M2JiOWI4OTAzY2U1MzE5MmY4ZCIsInNlc3Npb25faWQiOiI5NWI0YjRhOC0zZTFiLTQ3ZmUtYTk4NC1iMTc3ZGRhZGUxNDIiLCJleHAiOjE2OTUxMTE5MDYsImF1dGhvcml0aWVzIjpbIk5PUk1BTCJdLCJqdGkiOiJmMDc0Yjk2MC05YWU1LTRjMTAtYTIzYy0wN2NiNTU5ZDdkODAiLCJjbGllbnRfaWQiOiJjcmVhbXNfd2ViX2FwcCJ9.FWNqIhYi-UG0pohcVD1JwXrmUT9VvIrWIJ3gJNwPlAWbQypFDNrnjHBLAmSs1DcJt3Rebi-DVn-OhHUrdL0uAweH-OxjhQULYnUuhmXgfGuE6hO49McikurfqnCqI9ruRC_-2doPgR1VTrfX9-8r0D_9PzPcpRPUNAni0Q-RHmTpgcWg8AH95USYnf1A4tlEUvZ2OTxCcUmUWFm1zob2Y2AALLMJ-Ns7DbUdk8X8j6427bMuOK-wJR6PVv9d4T3fyo6fu-5fhLKLhTLqlO0rpkmc0vkdidcTJk9xHLQ3u1uuhLl999F9sCfeMTNtEGD72FITroOcZJYEfuxraC9zIw Version: leejiliang --WebAppBoundary Content-Disposition: form-data; name="file"; filename="incomeVerifyAmountData.xlsx" < /Users/leejiliang/Downloads/incomeVerifyAmountData.xlsx --WebAppBoundary--

将请求结果设置为全局变量供其他接口使用

### # @name 获取token POST {{host}}/v1/api/auth/login Content-Type: application/json { "vin": "TEpVQk1TQTIyUEswMDI1MDI=", "username": "", "device_id": "vin1_device2" } > {% client.global.set("auth_token", response.body.data.token); %} ### # @name 根据vin获取设备信息 POST {{host}}/v1/api/console/getDeviceByVin Content-Type: application/json Authorization: {{auth_token}} { "vin": "TEpVQk1TQTIyUEswMDI1MDI=" } ###