使用邮递员创建POST请求
此curl工作正常,并按预期返回令牌:使用邮递员创建POST请求,post,http-post,postman,restful-architecture,restful-authentication,Post,Http Post,Postman,Restful Architecture,Restful Authentication,此curl工作正常,并按预期返回令牌: curl -X POST -H "X-Requested-With: XMLHttpRequest" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{ "username": "pere.peris@gmail.com","password": "password" }' "http://75.90.255.68:1133/canPeris/auth" 但是,当我
curl -X POST -H "X-Requested-With: XMLHttpRequest" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{ "username": "pere.peris@gmail.com","password": "password" }' "http://75.90.255.68:1133/canPeris/auth"
但是,当我使用Postman应用程序进行相同的调用时,我会得到一个401作为返回值
您应该在正文中添加缺少的JSON。单击原始组合框并添加
{ "username": "pere.peris@gmail.com","password": "password" }
您应该在正文中添加缺少的JSON。单击原始组合框并添加
{ "username": "pere.peris@gmail.com","password": "password" }
您可以使用Postman中的函数生成卷曲: 在右侧的“发送”和“保存”下,只需点击代码按钮/链接。然后在下拉列表的下一个窗口中选择“卷曲”。因此,您可以看到将生成什么样的cURL,并将其与命令行进行比较
此处介绍了
-d
选项:您可以使用Postman中的函数生成卷曲:
在右侧的“发送”和“保存”下,只需点击代码按钮/链接。然后在下拉列表的下一个窗口中选择“卷曲”。因此,您可以看到将生成什么样的cURL,并将其与命令行进行比较
此处描述了-d
选项: