TIL: Testing HTTP Endpoints Locally With httpbin
httpbin is a simple HTTP request and response service. Send it a request, it tells you what you sent. It is invaluable for debugging clients.
curl -X POST https://httpbin.org/post -H 'Content-Type: application/json' -d '{hello: world}'
The response includes headers, body, origin IP, URL params, and more. You see exactly what your HTTP client sent on the wire.
{
headers: {
Content-Type: application/json,
User-Agent: curl/7.64.1
},
json: {hello: world}
}
I used httpbin to debug Vonage API integrations. When a webhook payload was not arriving the way I expected, I pointed the client at httpbin first. Nine times out of ten the issue was in how I was constructing the request, not in the API.
Can I run httpbin locally?
Yes. It is a Python Flask app. Run it with Docker or install it directly for offline testing.