It is with a great pleasure that we introduce Mockbin, service to help developers mock, test, and track HTTP calls with ease!
As maintainers of the popular Unirest HTTP Library and Mashape API marketplace supporting more than 10,000 APIs, we’re always testing against edge cases, and a variety of HTTP calls. Instead of relying on a random collection of services and tools to test different capabilities of an HTTP client and debug API requests, we created Mockbin in order to streamline our code and test with just a single source with guaranteed results, all while being able to inspect the same calls in the browser.
Today, we’re happy to open-source this tool we use internally and share it with the community
Creating a Bin
Bins are custom endpoints that produce pre-designed HTTP responses, Mockbin allows for creating and managing Bins either using the web interface or by calling the API endpoint with a HAR Response Object
That’s right: Mockbin uses the popular HAR format at its core to construct Bins and store access logs for maximum utility. This means you can directly extract HAR objects from your browser and use them in Mockbin to debug your HTTP calls!
Once you’ve created a Bin, you’re ready to hammer it with any combination of HTTP Methods, Headers, Query Strings and path parameters.
Your Bin will always respond in the same manner as dictated by the HAR Response Object at the time of creation. If you need a quick reminder of what each Bin is setup to do, you can review at
Review & Inspect the Call History
You can review every call made to your Bin by visiting the log view
/bin/:id/log in your browser.
Or if you like some of that dog food, you can call that same endpoint and get the history in HAR format.
Test with Confidence
Mockbin comes with some helpful utility endpoints such
/har, and more that will help you quickly validate the behavior of your client. Each of those endpoints accept ANY combination of HTTP Methods, Headers, Query Strings and even appending path parameters!
JSON not your thing? Perhaps you’re dealing with XML, or just want better readability? Mockbin supports JSON, XML, YAML, and of course HTML output in the browser.
We ♥ Open Source
Maybe you don’t want to wait for your tests to travel across the internet to make assertions against the mockbin.com servers? No problem! Mockbin is open source and is available right now on npm. It can also be used directly as a ready-to-run standalone web server, as an Express Middleware, or you can deploy it to Heroku with one click.
We’d love to hear your feedback, and welcome your contributions. Happy testing!