RestClient: 指用指南(vscode)

常用代码列表
更新于: 2024-10-13 07:28:09

cheatsheet

功能代码
正常的 GET 请求

正常的 CURL

curl -X GET "https://httpbin.org/get" -H "accept: application/json"

使用 httpClient

### Send a get request
GET https://httpbin.org/get
Accept: application/json
读取用户环境变量 $processEnv
@token = {{$processEnv GITHUB_ACCESS_TOKEN}}

GET https://api.github.com/repos/afeiship/nx/topics
Content-Type: application/vnd.api+json
Accept: application/vnd.github.v3+json
Authorization: Bearer {{ token }}
上传文件
POST http://backend-service-account-api.beta.saybot.net/api/v1/accessTokens/transient
Content-Type: application/json
Authorization: Bearer TOKEN

{"serviceName": "upload-service"}


### upload
POST http://upload.beta.saybot.net/upload/icon
Content-Type: multipart/form-data
Authorization: Bearer TOKEN

# read localpath/test.png
file: <@ /Users/a7/Downloads/pet.png
# content: /Users/a7/Downloads/pet.png