go-httpbin(1) v3.2.3

A golang port of the venerable httpbin.org HTTP request & response testing service.

ENDPOINTS

Note: All endpoints accept an optional ?response_delay=<duration> query parameter to add an initial delay before responding (e.g. ?response_delay=2s or ?response_delay=1-5 for a random delay).

DESCRIPTION

Testing an HTTP Library can become difficult sometimes. RequestBin is fantastic for testing POST requests, but doesn't let you control the response. This exists to cover all kinds of HTTP scenarios. Additional endpoints are being considered.

All endpoint responses are JSON-encoded.

EXAMPLES

$ curl http://localhost:8080/ip

{"origin":"73.238.9.52, 77.83.142.42"}

$ curl http://localhost:8080/user-agent

{"user-agent":"curl/7.64.1"}

$ curl http://localhost:8080/get?foo=bar

{
  "args": {
    "foo": [
      "bar"
    ]
  },
  "headers": {
    "Accept": [
      "*/*"
    ],
    "Host": [
      "localhost:8080"
    ],
    "User-Agent": [
      "curl/7.64.1"
    ]
  },
  "origin": "73.238.9.52, 77.83.142.42",
  "url": "http://localhost:8080/get?foo=bar"
}

$ curl http://localhost:8080/dump/request?foo=bar

GET /dump/request?foo=bar HTTP/1.1
Host: localhost:8080
Accept: */*
User-Agent: curl/7.64.1

$ curl -I http://localhost:8080/status/418

HTTP/1.1 418 I'm a teapot
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
X-More-Info: http://tools.ietf.org/html/rfc2324
Date: Tue, 13 Jul 2021 13:12:37 GMT
Content-Length: 0

$ curl http://localhost:8080/version

{"version":"abc1234","go_version":"go1.26"}

$ curl -o doc.pdf "http://localhost:8080/pdf?pages=3&size=large"

# Downloads a 3-page large PDF document

$ curl http://localhost:8080/problem?status=422&title=Validation+Failed

{"type":"about:blank","title":"Validation Failed","status":422,"detail":""}

$ curl -X POST -H 'Content-Type: text/plain' -d 'hello' http://localhost:8080/echo

hello

PIPELINE: COMPOSABLE URLs

Chain operations directly in the URL path. Prefix any endpoint with one or more modifiers to compose behavior, then specify a terminal endpoint.

Modifiers

Terminals

All single endpoints work as terminals. Grouped by category:

Error responses

Examples

Known Limitations

AUTHOR

Ported to Go by Will McCutchen.

From the original Kenneth Reitz project.

SEE ALSO

httpbin.org — the original httpbin