Postman是一款强大的API调试工具,在执行post请求时候会发现body有4种格式选项,那么这四种各是什么含义,及使用场景呢,各方检索后,总结如下
虽然Postman中看到的是form-data,x-www-form-urlencoded,raw,binary,但真实提交的数据格式并不是这4种方式,而是multipart/form-data,application/x-www-form-urlencoded,application/json,text/xml。
When a web browser sends a POST request from a web form element, the default Internet media type is “application/x-www-form-urlencoded”.[8] This is a format for encoding key-value pairs with possibly duplicate keys. Each key-value pair is separated by an ‘&’ character, and each key is separated from its value by an ‘=’ character. Keys and values are both escaped by replacing spaces with the ‘+’ character and then using URL encoding on all other non-alphanumeric[9] characters.
以上描述摘自WIKI