About FastAPI Httpbin

What is this?

This is FastAPI Httpbin, which is not quite an exact clone of, but heavily based on the rather famous website httpbin.org.

Why was it built?

I built it mainly as a way to teach myself the FastAPI Framework for Python. When I thought about what I wanted to build, I figured replicating some of the functionality of a project I understood pretty well would be a good first start. It would also give me the opportunity to do things slightly differently, based on some ideas I had in mind.

I also noticed that the original Httpbin appears to no longer be maintained, with some security holes now present in the website. That further pushed me in the direction of building a similar service.

How is this project different from Httpbin?

  • Unit tests for every endpoint.
  • Ensured that documentation 100% matches the responses returned.
  • Ensured that all values are now sanity checked
  • All endpoints with mandatory parameters now have examples in the documentation in order to reduce friction for test usage.
  • Fixed a few bugs found in the implementation of the /cache endpoints in Httpbin.
  • Several endpoints have the "GET" version only, as I did not see the point to supporting every possible HTTP verb--I felt that this just made the Swagger documentation unwieldly. (This is subject to change based on usage patters and demand)

I'm new to this site. What are some good endpoints to start testing?

Here are a few endpoints worth playing around with:

  • /headers - Return HTTP request headers that were sent
  • /response-headers - Return arbitrary HTTP headers
  • /uuid - Return a UUID
  • /delay/7 - Return a response after 7 seconds (useful for testing timeouts)
  • /status/200%2C403%2C502 - Return a status randomly chosen between 200, 403, and 502. Useful for testing flapping endpoints.
  • /redirect/3 - Return 3 HTTP 302 redirects before reaching the final page
  • /images/png - Return an image in PNG format

How can I test these endpoints?

Many of them you can test right in the web browser in the Swagger documentation on the front page of this site. But for some of them, you'll need more advanced tools. Here are a couple that I can recommend:

  • Curl - cUrl is the premier command-line tool for making HTTP requests.
  • Python 3 Requests module - This can be used to programatically make requests from Python apps.
  • NodePing - Used for monitoring websites, a good way to learn the platform would be to create monitors for one or more endpoints on this site.

What Comes Next?

That's covered on my roadmap page

Why Did You Deploy to Three Different Hosting Providers?

Because I could, and you're not my real dad!

That, and I wanted to learn more about each of these technologies, and I figured that deploying a stateless app would be a good way to get started.

You should totally clone my repo and try doing some deployments yourself! (Suggestions for additional providers to deploy to are welcome!)

Have You Built Anything Else?

Yep! I've built a few things you may find interesting:

Get In Touch

If you run into any problems, feel free to open an issue on GitHub.

Otherwise, you can find me on Twitter, Facebook, or drop me an email: doug.muth AT gmail DOT com.


Main Page