Using httpbin to test http/https requests
Posted by jpluimers on 2015/09/15
StackOverflow user Kenneth Reitz has written a great on-line and free httpbin tool that responds to many kinds of http/https requests including the standaard http request methods (or verbs) used by REST: get, post (for http 1.0) and patch, put, delete (for http 1.1).
These verbs are not supported: head (http 1.0) and trace, options, connect (http 1.1).
The site is geared towards JSON (as most the responses are in JSON, except for one XML response and a few TEXT responses), but even if your environment does not use JSON, it is very useful as you basically get an echo of information on what you pass to it.
Except one endpoint (/encoding/utf8), none of the response encodings can be determined by the request. This is a pity as sometimes it is good to see how a specific encoding works for JSON, but it is very hard to support encodings well, so I can understand the support is not there (or not there yet).
There are many examples on the site, which I won’t list.
There are at least two sites hosting them. The original supports HTTP and HTTPS only, but the ngHttp2 people also support HTTP2 and SPDY:
- httpBin: [WayBack] httpbin.org 0.9.0: A simple HTTP Request & Response Service.
- ngHttp2: [WayBack] httpbin(1): HTTP Client Testing Service
What I do list are the endpoints as copied from the site on 20141228:
/This page./ipReturns Origin IP./user-agentReturns user-agent./headersReturns header dict./getReturns GET data./postReturns POST data./patchReturns PATCH data./putReturns PUT data./deleteReturns DELETE data/encoding/utf8Returns page containing UTF-8 data./gzipReturns gzip-encoded data./deflateReturns deflate-encoded data./status/:codeReturns given HTTP Status code./response-headers?key=valReturns given response headers./redirect/:n302 Redirects n times./redirect-to?url=foo302 Redirects to the foo URL./relative-redirect/:n302 Relative redirects n times./cookiesReturns cookie data./cookies/set?name=valueSets one or more simple cookies./cookies/delete?nameDeletes one or more simple cookies./basic-auth/:user/:passwdChallenges HTTPBasic Auth./hidden-basic-auth/:user/:passwd404’d BasicAuth./digest-auth/:qop/:user/:passwdChallenges HTTP Digest Auth./stream/:nStreams n–100 lines./delay/:nDelays responding for n–10 seconds./drip?numbytes=n&duration=s&delay=s&code=codeDrips data over a duration after an optional initial delay, then (optionally) returns with the given status code./htmlRenders an HTML Page./robots.txtReturns some robots.txt rules./denyDenied by robots.txt file./cacheReturns 200 unless an If-Modified-Since or If-None-Match header is provided, when it returns a 304./cache/:nSets a Cache-Control header for n seconds./bytes/:nGenerates n random bytes of binary data, accepts optional seed integer parameter./stream-bytes/:nStreams n random bytes of binary data, accepts optional seed and chunk_size integer parameters./links/:nReturns page containing n HTML links./forms/postHTML form that submits to /post/xmlReturns some XML
–jeroen
via: [Wayback] HTTP Test server that accepts GET/Post calls – Stack Overflow.






Leave a comment