请求体格式有哪些呢?我总结了常见的这几种

347 阅读1分钟

Eoapi 中常见的请求体有这几种:

  • Json

    { "string": "test", "array": [{ "dom1": {}, "dom2": false, "dom3": [] }], "object": { "dom1": "", "dom2": 0 }, "null": null, "float": 11.11, "int": 1, "boolean": false }

  • Form-data

有两种格式的 Form-data(表单数据),multipart/form-data 和 application/x-www-form-urlencoded;

现代浏览器中,使用表单提交请求的情况已经比较少了,所以用得比较多的是 application/x-www-form-urlencoded,但是有一个特例,如果你的请求需要上传文件,那请求体格式无疑是 multipart/form-data 了。

1.Form-data[content-type="multipart/form-data;"]

------WebKitFormBoundaryNWnXbkVpqUPjFVZq
Content-Disposition: form-data; name="multiple"

2
------WebKitFormBoundaryNWnXbkVpqUPjFVZq
Content-Disposition: form-data; name="formDataStructure"

formDataStructure
------WebKitFormBoundaryNWnXbkVpqUPjFVZq--

2.Form-data[content-type="application/x-www-form-urlencoded"]

a=1&b=2
  • XML

    projectMember 000000 2177295417@qq.com [\u968f\u673a]\u65e0\u5d16\u5b50
  • Raw

    random text string

Eoapi 是一款简单、好用的开源 API 工具,基础功能仅包括 API 文档和测试, 满足我们开发者的核心需求。

github 地址:

github.com/eolinker/eo…

Demo 地址:

www.eoapi.io/?utm\_sourc…