声明一个常量用来放请求地址前缀

1
2
3
@baseurl = http://localhost:9090
###
post {{baseurl}}/api/login

GET发送 JSON 格式的数据

1
2
3
4
5
6
7
8
###
GET http://localhost:9090/user
Content-Type: application/json

{
"name":"zs",
"age":18
}

GET发送 url-encoded 格式的数据

1
2
3
4
5
###
GET http://localhost:9090/user
Content-Type: application/x-www-form-urlencoded

name=zs

注意:urlencoded 是 URL编码(URL encoding),也称作百分号编码(Percent-encoding), 是特定上下文的统一资源定位符 (URL)的编码机制(之前以为是查询字符串)

get发送带token的请求

1
2
3
4
###
get {{http}}/my/userinfo
Authorization: Bearer ...

post发送带token和参数的请求

1
2
3
4
5
post {{http}}/my/userinfo
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInBhc3N3b3JkIjoiIiwibmlja25hbWUiOm51bGwsImVtYWlsIjpudWxsLCJ1c2VyX3BpYyI6IiIsImlhdCI6MTYwNzg1OTAzMywiZXhwIjoxNjA3ODk1MDMzfQ.r_8FNBORP3Fs3irnblKbp14RImSmdJvV8qe1kJ109BM
Content-Type: application/x-www-form-urlencoded

id=1&nickname=haha&email=277784@qq.com

PUT发送请求

1
2
3
4
5
6
7
8
9
10
11
12
13
PUT {{baseurl}}/list/1
Content-Type: application/x-www-form-urlencoded

username=121aAaAaAaA2A22&&password=1213

###
PUT {{baseurl}}/list/2
Content-Type: application/json

{
"name":"1233",
"password":"234"
}