背景:登陆接口的类型是post,request接口的content-type是multipart/form-data; boundary=----WebKitFormBoundaryxeYAwSy6FSo4kow9
response接口的content-type是application/json; charset=utf-8
接口的请求体
在编写python脚本时post接口的请求头content-type定义了类型multipart/form-data; boundary=----WebKitFormBoundaryxeYAwSy6FSo4kow9
请求体data使用的数据结构是
{"accounts": "admin","pwd": "zlf123456","type": "username"}
或者
'{"accounts": "admin","pwd": "zlf123456","type": "username"}'
都校验失败,提示登陆类型有误
尝试删除content-type之后data使用{"accounts": "admin","pwd": "zlf123456","type": "username"}
可以校验成功
抓包查看接口请求自动带上了content-type=application/json; charset=utf-8
但是如果定义了content-type=application/json; charset=utf-8
data使用{"accounts": "admin","pwd": "zlf123456","type": "username"}就校验失败了
不定义content-type
json= {"accounts": "admin","pwd": "zlf123456","type": "username"}
不定义content-type
json= '{"accounts": "admin","pwd": "zlf123456","type": "username"}'