1 form-data
用于各种参数和文件上传
webflux的webClient可用BodyInserters.fromMultipartData和MultipartBodyBuilder来构建
请求头Content-Type: multipart/form-data; boundary=----XXXXXXXX
请求体:
----XXXXXXXX
Content-Disposition: form-data; name=“file”; filename=“aa.txt”
Content-Type: application/dxf (若非文件上传,无需filename和Content-Type)
contentcontent
----XXXXXXXX
…
----XXXXXXXX–
2 x-www-form-urlencoded
请求头Content-Type: application/x-www-form-urlencoded
请求体:name=java&age=23
3 raw
请求头Content-Type: application/json;charset=utf-8
请求体:
这里可以是json,xml等,注意要加charset
4 binary
用于上传文件(二进制数据),无参数名只能传单个文件
Content-Type:application/octet-stream
5下载
Content-Disposition: attachment;filename=FileName.txt (attachment告知浏览器对话框下载 ,inline页面展示文件)