Http 为什么邮递员post请求不发送正文变量?
我正试图通过邮递员发送一个普通的邮寄请求。我也通过Curl做了同样的事情,我的服务器看到它很好。以下是主体的设置: 以下是控制台中的请求: 我的express服务器没有看到主体变量。像这样的卷曲会:Http 为什么邮递员post请求不发送正文变量?,http,curl,post,Http,Curl,Post,我正试图通过邮递员发送一个普通的邮寄请求。我也通过Curl做了同样的事情,我的服务器看到它很好。以下是主体的设置: 以下是控制台中的请求: 我的express服务器没有看到主体变量。像这样的卷曲会: curl -X POST https://xxx.appspot.com -d "volume=123&content=foobar" 我需要做哪些更改才能使其生效?这两个示例并不相同,因为对于Postman,您有内容类型:text/plain标题集,但通过curl
curl -X POST https://xxx.appspot.com -d "volume=123&content=foobar"
我需要做哪些更改才能使其生效?这两个示例并不相同,因为对于Postman,您有
内容类型:text/plain
标题集,但通过curl-d
选项发送数据,设置内容类型:application/x-www-form-urlcoded
。从curl
手册页:
-d, --data <data>
(HTTP MQTT) Sends the specified data in a POST request to the
HTTP server, in the same way that a browser does when a user has
filled in an HTML form and presses the submit button. This will
cause curl to pass the data to the server using the content-type
application/x-www-form-urlencoded.
-d,--data
(HTTP MQTT)将POST请求中的指定数据发送到
HTTP服务器,与浏览器在用户具有
填写HTML表单并按下提交按钮。这将
使curl使用内容类型将数据传递给服务器
application/x-www-form-urlencoded。
我对邮递员没有任何经验,但我猜你需要选择
x-www-form-urlencoded
按钮,而不是当前的raw
按钮。这是必需的。我很高兴它能起作用。