开发者

How to easily test POSTs when making a website?

开发者 https://www.devze.com 2023-03-05 02:17 出处:网络
What\'s an easy way to test sending POST requests when making a website? I can easily send GET requests by typing it in the URL (example.com/?foo=开发者_Go百科bar&bar=baz) but what\'s an equivalen

What's an easy way to test sending POST requests when making a website? I can easily send GET requests by typing it in the URL (example.com/?foo=开发者_Go百科bar&bar=baz) but what's an equivalently easy way to send POST requests?


Curl CLI

curl -d "param1=value&param2=value2" http://www.example.com/resource

or

curl -F "fileupload=@filename.txt" http://www.example.com/resource

https://superuser.com/questions/149329/how-do-i-make-a-post-request-with-curl/149335#149335

But I always just use a test script with a http request class. I find you get finer granularity over headers, formats, verb, etc. And of course you can put that code into a unit test after you're done. I use this class that I wrote ( https://github.com/homer6/altumo/blob/master/source/php/Http/OutgoingHttpRequest.md ) but I hear that the zend request class is quite good too.


You can use Fiddler or a Browser plugin like FireFox Tamper Data.

Or you can just create a form and submit it from any .HTML page:

<form action="TestPage.html" method="POST">
    <input name="name1" value="value1" />
    <input name="name2" value="value2" />
    <input type="submit" value="POST!" />
</form>


you can use any inspector to do that like fireFox

make request type post >> put your url >> put parameters in request body section

How to easily test POSTs when making a website?


try some http request sending tools like Wfetch


Postman in Google Chrome, is a great tool to test POST methods.

0

精彩评论

暂无评论...
验证码 换一张
取 消