我知道这无关紧要,但是我正在处理的主机由于报头的顺序而一直拒绝我的请求。通过我的代码发送的请求如下所示:
POST https://www.expedia.co.in/Hotel-Search-Data HTTP/1.1
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Accept: application/json, text/javascript
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.76 Safari/537.36
Connection: keep-alive
Host: www.expedia.co.in
Content-Length: 112
destination=Surat, India®ionId=3290&startDate=02/07/2018&endDate=03/07/2018&adults=1&hsrIdentifier=HSR&Page=1
有效的请求是这样的:
POST https://www.expedia.co.in/Hotel-Search-Data HTTP/1.1
Host: www.expedia.co.in
Connection: keep-alive
Content-Length: 112
Accept: application/json, text/javascript
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.76 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.5
destination=Surat, India®ionId=3290&startDate=02/07/2018&endDate=03/07/2018&adults=1&hsrIdentifier=HSR&Page=1
是否可以更改标题的顺序?我已经使用WebClient和HTTPClient尝试过了,都没有用。
答案 0 :(得分:0)
content-length
是错误的。
正文不应以&
POST不应包含查询字符串;删除?haha=false
。