Drop #384 (2023-12-06): Alternate "Bins"

httpbun; postman-echo; go-httpbin

Tis a crazy week in hrbr-land, so a very light, but focused, Drop, today, showcasing three decent alternatives to the OG HTTPbin.


For those new to HTTPbin…

HTTPBin is a remarkable HTTP request and response service, written in Python, that provides a simple yet powerful tool for testing and debugging HTTP-related services. The project, led by Kenneth Reitz, offers a Docker container that allows users to easily run the service locally. The source repository on GitHub provides transparent access to the project’s codebase, enabling collaboration and contribution from the community.

The Docker container, available from various sources, further simplifies the deployment of HTTPBin.

This service has been/is invaluable for developers, QA folks, and security researchers, as it facilitates the inspection and manipulation of HTTP requests and responses.

However, as we will see, it’s not the only game in town, anymore.

TL;DR

This is an AI-generated summary of today’s Drop.

  • httpbun is a service that provides various endpoints to simulate different HTTP requests and offers additional features such as the /mix endpoint, the /payload endpoint, and the ability to accept any method in most endpoints.

  • Postman Echo is a service provided by Postman that allows users to test their REST clients and make sample API calls, providing endpoints for various HTTP methods and some nifty utility endpoints.

  • Go-HTTPBin is a Golang port of HTTPBin with zero external dependencies, making it unique among similar services such as Postman Echo, httpbun, and httpbin. It offers a public instance for testing and can be used as a testing helper library, providing endpoints to simulate different HTTP requests.


httpbun

brown bread on green plate

httpbun (GH) is another service that helps us test the behavior of HTTP clients like browsers, libraries, and developer tools. It provides various endpoints to simulate different HTTP requests and inspect the details of the requests. Inspired by httpbin, httpbun offers additional features such as the /mix endpoint, the /payload endpoint, and the ability to accept any method in most endpoints (and, not ignoring bodies in /get requests). It also provides a self-signed HTTPS certificate for testing purposes.

Like the other tools in this category, httpbun simulates different types of HTTP requests, allowing developers to test and debug their HTTP clients more effectively. By providing endpoints for common HTTP methods such as GET, POST, PUT, PATCH, and DELETE, it enables folks to inspect the request details, including headers, body, and parameters. This can be extremely useful for troubleshooting and understanding how HTTP clients interact with various APIs and web services.

To illustrate, here are two curl examples using httpbun.

Sending a POST request with form data:

$ curl -X POST -d 'one=1' https://httpbun.com/post
{
  "method": "POST",
  "args": {},
  "headers": {
    "Accept": "*/*",
    "Accept-Encoding": "gzip",
    "Content-Length": "5",
    "Content-Type": "application/x-www-form-urlencoded",
    "Host": "httpbun.com",
    "User-Agent": "curl/8.4.0"
  },
  "origin": "REDACTED",
  "url": "https://httpbun.com/post",
  "form": {
    "one": "1"
  },
  "data": "",
  "json": null,
  "files": {}
}

Sending a POST request with JSON data and a custom header:

$ curl -X POST -d '{"one": 1}' -H 'Content-Type: application/json' https://httpbun.com/post
{
  "method": "POST",
  "args": {},
  "headers": {
    "Accept": "*/*",
    "Accept-Encoding": "gzip",
    "Content-Length": "10",
    "Content-Type": "application/json",
    "Host": "httpbun.com",
    "User-Agent": "curl/8.4.0"
  },
  "origin": "REDACTED",
  "url": "https://httpbun.com/post",
  "form": {},
  "data": "{\"one\": 1}",
  "json": {
    "one": 1
  },
  "files": {}
}

You can run it locally or use the free, public service.

postman-echo

person searching inside cargo box during daytime

Postman Echo is a service provided by Postman. It, too, allows users to test their REST clients and make sample API calls. It provides endpoints for various HTTP methods, including GET, POST, PUT, PATCH, HEAD, DELETE, etc. — along with support for Basic Auth, OAuth 1.0, Digest Auth, and OAuth 2.0. It also includes some nifty utility endpoints:

Here are some examples:

Basic auth:

$ curl -u postman:password https://postman-echo.com/basic-auth
{
  "authenticated": true
}

Server events:

$ curl -s https://postman-echo.com/server-events/3
event: error
data: Error encountered while processing event
id: 1

event: ping
data: Server time is 2023-12-05T16:10:42+00:00
id: 2

event: info
data: Keep listening to server updates
id: 3

Leap year check:

$ curl -s https://postman-echo.com/time/leap?timestamp=2016-10-10
{
  "leap": true
}

go-httpbin

person holding brown and gray rodent

Go-HTTPBin (GH) is yet-another froody testing tool that provides a complete and well-tested Golang port of the venerable HTTPBin service, with the distinctive feature of having zero dependencies outside the Go standard library. This makes it stand out from other similar services such as Postman Echo, httpbun, and httpbin. The associated website, HTTPBingo, offers a public instance of the HTTPBin service for testing purposes.

The go-httpbin library can, itself, be used as a testing helper library, enabling us to test our app’s interactions with an upstream HTTP service. It provides a range of endpoints to simulate different HTTP requests and inspect the details of the requests, similar to other services. However, its unique feature of being a Golang port with the aforementioned zero external dependencies makes it an attractive choice for Golang developers.

You can hit up the README for an example of using it in a testing capacity.

FIN

Do you use HTTPbin? One of these alternatives? Something else? ☮️

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.