将(原始)请求从GET转换为POST

时间:2017-01-09 17:39:18

标签: http http-headers

在这里我有http GET请求。

GET http://www.uw-team.org/hm3next/loguj.php HTTP/1.1
Host: www.uw-team.org
Proxy-Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4

我想将此请求从GET转换为POST方法,并在请求正文中添加一些参数。所以我从

改变了第一行
GET http://www.uw-team.org/hm3next/loguj.php HTTP/1.1

POST http://www.uw-team.org/hm3next/loguj.php HTTP/1.1

并添加了请求正文:

... 
Accept-Encoding: gzip, deflate, sdch
Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4

param1=val&param2=val2   

我需要更改/添加其他内容吗?

1 个答案:

答案 0 :(得分:0)

对于该请求正文,请添加:

Content-Type: application/x-www-form-urlencoded

这就是你所需要的一切。

查看有关POST method的更多信息 和application/x-www-form-urlencoded