I'm in the need of a tool to help debugging a web application. Is there some simple client tools that allow you to easily send and construct customizable POST [1]/ GET [2]/ PUT [3]/ DELETE [4] HTTP requests?
Some curl
examples:
GET
curl -HAccept:text/plain http://example.com/base
PUT
curl -XPUT -HContent-type:text/plain --data "stuff:morestuff" http://example.com/base?param=val
DELETE
curl -XDELETE http://example.com/base/user/123
POST
curl -d "param1=value1¶m2=value2" http://example.com/base/
application/x-www-urlencoded
format, use the --data-binary
option instead of --data
. - Kevin Reid
For Windows,
WFetch
[1] is your quick and dirty answer.
Direct download link can be found
here
[2].
RESTClient [1] is a Firefox extension. Also worth looking at is Poster [2] - another extension.
[1] https://addons.mozilla.org/en-US/firefox/addon/9780I absolutely love http://apikitchen.com it is one versatile tool that I have seen for HTTP debugging. They are offering a Mac client for testing within internal networks else you can use their hosted solution with permalinks to share the API output with other developers.
Fiddler [1] (free web debugger) allows you to write HTTP requests to webapps.
[1] http://www.fiddler2.com/fiddler2/I found the Postman plugin [1] for Google Chrome to be very helpful for testing REST interfaces. It can POST, GET, PUT and DELETE, set headers, reply messages, etc.
[1] https://chrome.google.com/webstore/detail/fdmmgilgnpjigdojojpjoooidkmcomcmSome RESTful [1] JSON examples that work on my Mac:
GET (Browse)
curl "http://localhost/myservice/?page=1&size=50"
PUT (Update)
curl -i -X PUT -H Accept:application/json -H Content-Type:application/json -d '{id:47,user:{firstname:"Joe",lastname:"Smith","phone":"555-555-1212"}}' 'http://localhost/myservice/'
POST (Create)
curl -i -X POST -H Accept:application/json -H Content-Type:application/json -d '{user:{firstname:"Jane",lastname:"Smith","phone":"555-555-1212","relatedTo":[47]}}' 'http://localhost/myservice/'
DELETE (Remove)
curl -i -X DELETE -H Accept:application/json -H Content-Type:application/json 'http://localhost/myservice/47'
[1] http://en.wikipedia.org/wiki/Representational_state_transfer#RESTful_web_servicesThe grandaddy of them all is Telnet [1]. Just open a connection on port 80 and type in the raw commands. Most of the basic Internet protocols, such as HTTP and mail, are text-based and this is part of the reason why.
Of course, if you prefer something more abstract, there are also command-line utilities like Wget [2] and cURL [3].
[1] http://en.wikipedia.org/wiki/TelnetThe best tool to do that is httest [1]. You can get it for Windows or Debian/Ubuntu, just do:
apt-get install httest
httest is also available in source and do run on any Unix System.
To generate a client, write the following script.
CLIENT
_REQ localhost 80
__POST /foo/bar HTTP/1.1
__Host: localhost
__Content-Length: AUTO
__
__my=param&next=foo
_EXPECT . "200 OK"
_WAIT
END
If something is different than 200 OK
is returned, the script failed. __POST can be any method like __DELETE or __GET or __FOO
__ is the send command ;)
Run your script with
httest your_script.htt
If you download the newest httest, there are also macros to simplify browser-like requests.
[1] http://htt.sourceforge.net/cgi-bin/cwiki/bin/public
Wget
[1] is very versatile. TIP: use wget -d
to get full debugging information about the request and response.
For non-automated testing, the Live HTTP Headers [1] add-on for Firefox can be used to alter and replay requests. (It can also change the request method; though the request method dropdown only shows GET and POST, one can actually type whatever one likes, even invalid methods. One could also type the whole request payload, but I assume the other answers offer better solutions for that.)
The online Web-Sniffer [2] might be useful to see a response [3] without rendering it.
(The
Web Developer Toolbar
[4] can easily change the method
attribute in a <form>
itself, which after submitting once might make it easy to change request parameters, in some limited cases. One can achieve the same with any tool like Firebug or Web Inspector.)
User adib
mentioned a utility for the Mac. I've been using
HTTP Client
[1] and have had no problems with it at all. It supports
GET
[2],
POST
[3], PUT, DELETE, TRACE, OPTIONS, HEAD, and CONNECT.
I hope that helps :)
[1] http://ditchnet.org/httpclient/The Burp proxy tool [1] is easy to use. It is external to the browser which is nice. Some of the other tools that integrate into the browser as a plug-in have advantages too.
You can see all HTTP [2]/ HTTPS [3] requests and responses and edit them if desired.
[1] http://en.wikipedia.org/wiki/Burp_suite#Proxy_server
httpie
- it is well-documented and easy to use. It is cross-platform (Python) - Colonel Panic