rest client插件在不需要表单的前提下进行php文件上传模拟,怎么做?这篇文章完美解决了!!

217 阅读1分钟

image.png

###
# gtr
GET http://localhost:80/api/item
Accept: application/json

### 
# gtrp 
GET http://localhost:80/api/item?id=99
Accept: application/json

###
# prt
POST http://localhost:80/api/item
Content-Type: application/json

{}

###
#ptrp
POST http://localhost:80/api/item
Content-Type: application/x-www-form-urlencoded

id=99&content=new-element

###
# mptr
POST http://localhost:80/api/item
Content-Type: multipart/form-data; boundary=WebAppBoundary

--WebAppBoundary
Content-Disposition: form-data; name="field-name"

field-value
--WebAppBoundary--

###
# fprt
POST http://localhost:80/api/item
Content-Type: multipart/form-data; boundary=WebAppBoundary

--WebAppBoundary
Content-Disposition: form-data; name="field-name" filename="file.txt"

< ./relative/path/to/local_file.txt
--WebAppBoundary--

###