HTTP test server accepting GET/POST requests
Solution 1
It echoes the data used in your request for any of these types:
- https://httpbin.org/anything Returns most of the below.
- https://httpbin.org/ip Returns Origin IP.
- https://httpbin.org/user-agent Returns user-agent.
- https://httpbin.org/headers Returns header dict.
- https://httpbin.org/get Returns GET data.
- https://httpbin.org/post Returns POST data.
- https://httpbin.org/put Returns PUT data.
- https://httpbin.org/delete Returns DELETE data
- https://httpbin.org/gzip Returns gzip-encoded data.
- https://httpbin.org/status/:code Returns given HTTP Status code.
- https://httpbin.org/response-headers?key=val Returns given response headers.
- https://httpbin.org/redirect/:n 302 Redirects n times.
- https://httpbin.org/relative-redirect/:n 302 Relative redirects n times.
- https://httpbin.org/cookies Returns cookie data.
- https://httpbin.org/cookies/set/:name/:value Sets a simple cookie.
- https://httpbin.org/basic-auth/:user/:passwd Challenges HTTPBasic Auth.
- https://httpbin.org/hidden-basic-auth/:user/:passwd 404'd BasicAuth.
- https://httpbin.org/digest-auth/:qop/:user/:passwd Challenges HTTP Digest Auth.
- https://httpbin.org/stream/:n Streams n–100 lines.
- https://httpbin.org/delay/:n Delays responding for n–10 seconds.
Solution 2
There is http://ptsv2.com/
"Here you will find a server which receives any POST you wish to give it and stores the contents for you to review."
Solution 3
Webhook Tester is a great tool: https://webhook.site (GitHub)
Important for me, it showed the IP of the requester, which is helpful when you need to whitelist an IP address but aren't sure what it is.
Solution 4
http://requestb.in was similar to the already mentioned tools and also had a very nice UI.
RequestBin gives you a URL that will collect requests made to it and let you inspect them in a human-friendly way. Use RequestBin to see what your HTTP client is sending or to inspect and debug webhook requests.
Though it has been discontinued as of Mar 21, 2018.
We have discontinued the publicly hosted version of RequestBin due to ongoing abuse that made it very difficult to keep the site up reliably. Please see instructions for setting up your own self-hosted instance.
Solution 5
nc
one-liner local test server
Setup a local test server in one line under Linux:
nc -kdl localhost 8000
Sample request maker on another shell:
wget http://localhost:8000
then on the first shell you see the request showed up:
GET / HTTP/1.1
User-Agent: Wget/1.19.4 (linux-gnu)
Accept: */*
Accept-Encoding: identity
Host: localhost:8000
Connection: Keep-Alive
nc
from the netcat-openbsd
package is widely available and pre-installed on Ubuntu.
Tested on Ubuntu 18.04.
John Twigg
Updated on July 08, 2022Comments
-
John Twigg almost 2 years
I need a live test server that accepts my requests for basic information via HTTP GET and also allows me to POST (even if it's really not doing anything). This is entirely for test purposes.
A good example is here. It easily accepts GET requests, but I need one that accepts POST requests as well.
Does anyone know of a server that I can send dummy test messages too?
-
ozmo over 11 yearsThis one is really good if you're running requests that are triggered from a remote server whose internals you don't have access to, as it will save the request for later retrieval.
-
user3280180 over 9 yearsIs there also the possibility to create a local httpbin server?
-
HVNSweeting about 9 years@user3280180
$ pip install httpbin gunicorn && gunicorn httpbin:app
as mentioned is httpbin.org -
abalter almost 9 yearsThe point is to not have to use a server. For instance, what if you want to post a question to SO, but your server may not be around for long. The OP is asking for something permanent such as jsfiddle that can be used to test or demonstrate post.
-
Pablo Cantero over 8 yearsPutsReq is also similar to RequestBin, but it allows you to write the responses you want with JS.
-
therobyouknow over 8 yearsHow do you use it - httpbin.org/post doesn't work and on httpbin.org the link has been disabled - it's no longer clickable. Is there something else one should do here? There's no guidance, I'm not a mind reader...
-
Robert over 8 years@therobyouknow clicking the link performs a GET, but if you do a POST to that url it works. Try:
curl -iX POST httpbin.org/post
it returns a 200. -
AlbatrossCafe about 8 yearsGreat site - it seems the most intuitive and has good documentation that helps you check for things like request type, headers, form data, etc.
-
user239558 about 8 yearsAt least httpbin.org/headers will return 405 - Method Not Allowed on POST, so this should not be an accepted answer.
-
byxor over 7 yearsI know literally anything could be used... But is there a "gettestserver" that's expected to stay up for a long time?
-
ViFI over 7 yearsUnlike httpbin.org/put , it returns a very useful response which gives details about your request. Specially in case of file upload , it is very helpful as you can see your file uploaded on the server which i believe is not possible on httpbin.org .
-
fidev almost 7 yearsagreed has nice features where by you can set the specific response you require. i.e. 200 / 301, 401 etc. Good if you want to simulate an error or in my case not route to a page when using a resolve in Angular if the data to render that page hasn't come back (yet)
-
ntninja almost 6 yearsThe „cool“ thing about this is that it doesn't use TLS/HTTPS which makes it very easier to debug the bytes on wire.
-
sn.anurag over 5 yearsIt doesn't display the post data.. I need to see post data.
-
William S over 5 years
nc -kdl localhost 8000
will listen in a loop, so no need for the bashwhile
. However,nc
will not respond, so the test queries will wait until timeout for the non-response. -
AmokHuginnsson about 5 yearsRequestBin is no longer available.
-
goodeye almost 5 yearsThis is very useful to see the request later. But note it has a 1500 char body size limit.
-
Oleg Khalidov about 4 yearsThumb up for https
-
nikniknik about 4 years
while true; do echo -e "HTTP/1.1 200 OK\n" | nc -Nl 8000; done
will make nc respond with a 200 OK code every time. -
Sean Breckenridge over 3 years
alias httpbin='docker run -p 80:80 kennethreitz/httpbin'
👍 -
Silvio Biasiol over 3 yearson mac is just
nc -l 12345
-
oneworld about 3 yearsGreat tool. I can set my response as I need for my program.
-
Christopher Pisz about 3 yearsI get 404 on all redirect urls
-
Ubdus Samad almost 3 yearsCurrently, httpbin.org isn't working for retries and redirects, so you can use
mockbin.org
-
Flair over 2 yearsrequestb.in now redirects to pipedream.com/requestbin
-
Mike over 2 yearsPlease explain how a single one of these options applies to what the OP asked
-
Clain Dsilva about 2 yearsWhy not just use
print_r($headers)
and avoid the foreach loop?