Postman Post请求四种参数传递方式与Content-Type对应关系

Postman post 请求四种数据传递类型代表的Content-Type类型:
1、form-data : 对应的Content-Type:multipart/form-data;boundary= 表示文件上传;
2、x-www-form-urlencoded:对应的Content-Type:application/x-www-form-urlencoded 表示表单提交;
3、raw:对应的Content-Type分为五类:

  text:对应的Content-Type:text/plain 【对应表示文本】

  javascript:对应的Content-Type:application/javascript 【对应表示javascript脚本 】

  json:对应的Content-Type:application/json 【对应表示json数据格式】

  html:对应的Content-Type:text/html 【对应表示html或文本类型】

  xml:对应的Content-Type:application/xml【对应表示xml类型】

4、binary:对应的Content-Type:application/binary【对应表示二进制类型】

data 和json传参以及Content-Type 的关系如下:
1、data传参:报文是dict类型,那么默认Content-Type:application/x-www-form-urlencoded
data传参:报文是str类型,那么默认Content-Type:text/plain
2、json传参:报文可以是dict 类型,那么默认Content-Type:application/json

备注:
1、Content-Type 的获取可以通过接口文档,如果接口文档没有提供我们可以通过抓包工具抓取后查看;

2、备注:Content-Type: 作用是指定服务器要求传入的报文的内容类型

你可能感兴趣的:(postman,测试工具)