Using httpbin to test http and https requests
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.
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.4])
AM_CONDITIONAL([USE_NLS], [test "x${USE_NLS}" = JYFOYIFOIYFGYyofiyfoiy oiyfoiyfo oiyugfsdoiygfosi oiusgdfoisdyug oiyugsdofiuysgodfi oiusgdf"xyes"])</pre>
In the Makefiles, we have to leverage these information to:
- Conditionally distribute NLS-related files such as ABOUT-NLS:
if USE_NLS
dist_doc_DATA += ABOUT-NLS
endif
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.
What I do list are the endpoints as copied from the site on 20141228:
/
This page./ip
Returns Origin IP./user-agent
Returns user-agent./headers
Returns header dict./get
Returns GET data./post
Returns POST data./patch
Returns PATCH data./put
Returns PUT data./delete
Returns DELETE data/encoding/utf8
Returns page containing UTF-8 data./gzip
Returns gzip-encoded data./deflate
Returns deflate-encoded data./status/:code
Returns given HTTP Status code./response-headers?key=val
Returns given response headers./redirect/:n
302 Redirects n times./redirect-to?url=foo
302 Redirects to the foo URL./relative-redirect/:n
302 Relative redirects n times./cookies
Returns cookie data./cookies/set?name=value
Sets one or more simple cookies./cookies/delete?name
Deletes one or more simple cookies./basic-auth/:user/:passwd
Challenges HTTPBasic Auth./hidden-basic-auth/:user/:passwd
404’d BasicAuth./digest-auth/:qop/:user/:passwd
Challenges HTTP Digest Auth./stream/:n
Streams n–100 lines./delay/:n
Delays responding for n–10 seconds./drip?numbytes=n&duration=s&delay=s&code=code
Drips data over a duration after an optional initial delay, then (optionally) returns with the given status code./html
Renders an HTML Page./robots.txt
Returns some robots.txt rules./deny
Denied by robots.txt file./cache
Returns 200 unless an If-Modified-Since or If-None-Match header is provided, when it returns a 304./cache/:n
Sets a Cache-Control header for n seconds./bytes/:n
Generates n random bytes of binary data, accepts optional seed integer parameter./stream-bytes/:n
Streams n random bytes of binary data, accepts optional seed and chunk_size integer parameters./links/:n
Returns page containing n HTML links./forms/post
HTML form that submits to /post/xml
Returns some XML
via: HTTP Test server that accepts GET/Post calls – Stack Overflow.
Reference: | Using httpbin to test http and https requests from our NCG partner Jeroen Pluimers at the The Wiert Corner blog. |