A service to help test the behaviour of HTTP clients like browsers, libraries, developer tools or anything else. Inspired by httpbin. Built because httpbin lacked some things I needed, like:
/mix endpoint, and the Mixer, with powerful ingredients like:
slack directive.
t directive.
/run endpoint, and the Runner. (Beta).
x-www-form-urlencoded payloads.
--root-is-any enabled.
https://self-signed-cert.httpbun.com that uses a self-signed HTTPS certificate.
★ Star this project on GitHub.
/mix/s=400/h=x-custom-header:some-valueThe
s= and h= are directives that /mix understands. Supported directives are:
s: HTTP response status code.
h: Set a response header, in the form name:value.
c: Set a cookie, in the form name:value.
r: Set a redirect URL. Uses status code 307. To change, use s= directive.
b64: Set the response body to the base64 decoded value.
t: The base64 decoded value of this, is rendered as a Golang text template, and the result is
used as the response body.
end: Takes no value, marks the end of directive processing. Path segment after this is ignored
by Httpbun.
curl httpbun.ax.stdin.in/get
curl -X POST -d 'one=1' httpbun.ax.stdin.in/post
curl -X POST -d '{"one": 1}' -H 'content-type:application/json' httpbun.ax.stdin.in/post
curl -X PUT httpbun.ax.stdin.in/put
curl -X PATCH httpbun.ax.stdin.in/patch
curl -X DELETE httpbun.ax.stdin.in/delete
/any is also accepted.headers which is an object of all the headers in
the request, as keys and values. If a header repeats in the request, then its values are concatenated with a
comma and treated as a single header value.
curl -H 'x-custom: custom header value' httpbun.ax.stdin.in/headers
Content-Type header as the request and the body of the request as is.
curl -H 'Content-Type: text/plain' -d 'plain body' httpbun.ax.stdin.in/payload
curl -H 'Content-Type: application/json' -d '{"a": 1}' httpbun.ax.stdin.in/payload
username and password as the credentials.
curl -H 'Authorization: Basic c2NvdHQ6dGlnZXI=' httpbun.ax.stdin.in/basic-auth/scott/tiger
Authorization header in the request, that takes the
form Bearer some-auth-token-here. If no expectedToken is given, any token will be
treated as valid. If no Authorization header is present in the request, this results in a 401
response.
curl -H 'Authorization: Bearer auth_token_here' httpbun.ax.stdin.in/bearer
curl -H 'Authorization: Bearer expected_token' httpbun.ax.stdin.in/bearer/expected_token
/digest-auth/auth/scott/tiger requires to be authenticated with
the credentials scott and tiger as username and password. The implementation is based
on this example from Wikipedia. The value of qop can be one of auth
(default), auth-int or auth,auth-int.
origin, with the client's IP Address for value.
If-Modified-Since or If-None-Match header, returns a 304
response. Otherwise, it behaves the same as /get for GET requests,
/post for POST requests, etc.
Cache-Control header for age seconds.codes. It can be a comma-separated list of multiple
status codes, of which a random one is chosen for the response.
/response-headers?one=two, there is a header called One, whose value is
two.
The response body contains all the headers again, in the form of a JSON object. (This JSON object in the
response should be considered deprecated, and may be removed in the future.)
text. The first two letters of the
text are also shown at the center of the circle. Examples:
svg/bun,
svg/foo.
encoded text with base64 encoding scheme. Defaults to
SFRUUEJVTiBpcyBhd2Vzb21lciE=.
count random bytes in the response. The Content-Type header is set to
application/octet-stream. The randomness is not cryptographically secure.
seconds seconds. The seconds parameter can be a positive
integer or floating point number.
*
character. The following query params can be used to configure this endpoint:
duration: Total number of seconds over which to stream the data. Default: 2.
numbytes: Total number of bytes to stream. Default: 10.
code: The HTTP status code to be used in their response. Default: 200.
delay: An initial delay, in seconds. Default: 2.
/drip-lines, a newline character is written after every piece of data.
count links, which in turn respond with HTML documents with links
again. You mostly want to use the first version (i.e., without offset).
count random bytes, that are generated with the same random seed every time. The
value of count is capped to 1000.
name to value.url query param. If a status
query param is also given, it is used as the HTTP Status code in the response. Otherwise, 302 is used.
count times. For example, /redirect/3 will redirect three times before
settling on a response. The redirect URLs specified in the Location header will be
relative URLs.
count times. For example, /redirect/3 will redirect three times before
settling on a response. The redirect URLs specified in the Location header will be
absolute URLs.
With Docker: docker run -p 80:80 sharat87/httpbun
From source, with task installed: task run
If using for your project's CI, please consider running a self-hosted version using the Docker container. An example of this is in the container-run.yml workflow.
localhost:3090, which configures the server
to listen on TCP port 3090 on localhost.HTTPBUN_BIND environment variable.
the-one,
then the /get endpoint will be available on /the-one/get. Similarly, all other
endpoints are also prefixed with the value of this argument.
/any. This means that
when this option is given, all HTML pages will also become inaccessible. Like the homepage, Mixer UI, help pages
etc. A hosted instance with this option enabled is available at
any.httpbun.com.
Httpbun is distributed with the Apache-2.0 License. Please refer to the LICENSE and NOTICE files present in the source distribution of this project.
The bun icon was generated using the following graphics from Twitter Twemoji:
1fad3.svg.