简体   繁体   English

在Linux cURL请求中始终收到400错误的响应

[英]Always Receiving 400 Bad Response in Linux cURL Request

I am hitting RabbitMQ remote server and trying to fetch the channels, using the below curl call: 我正在使用Rabbit的远程服务器访问RabbitMQ并尝试使用以下curl调用来获取频道:

curl -i -X GET https://192.168.180.23:15671/api/channels -H 'accept:text/html,application/xhtml+xml,application/xml;q=0.9, / ;' curl -i -X GET https://192.168.180.23:15671/api/channels -H'accept:text / html,application / xhtml + xml,application / xml; q = 0.9, / ;' -H 'accept-encoding: gzip, deflate' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Basic cGhpYWRtaW46MW5mME1AdDFjc1BoIWx0MHI=' -H 'connection: keep-alive' -H 'upgrade-insecure-requests: 1' -k -H'接受编码:gzip,deflate'-H'接受语言:zh-cn,en; q = 0.9'-H'授权:基本cGhpYWRtaW46MW5mME1AdDFjc1BoIWx0MHI ='-H'连接:keep-alive'-H'升级-不安全的请求:1'-k

But getting 400 Bad Request Response 但是得到400错误的请求响应

HTTP/1.1 400 Bad Request server: Cowboy date: Sun, 11 Mar 2018 05:00:21 GMT content-length: 0 vary: origin HTTP / 1.1 400错误的请求服务器:牛仔日期:2018年3月11日,星期日05:00:21 GMT内容长度:0变化:来源

But getting 200 Response when I am making same call using Postman. 但是当我使用邮递员拨打相同的电话时获得200响应。

well, I found the answer, a ; 好了,我找到了答案,一个; was causing the problem. 造成了问题。 So, it should be 所以应该

-H 'accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*'

Instead of -H 'accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;' 代替-H 'accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM