I use services like Requestbin to capture HTTP requests alot while developing or troubleshooting. This is my 'lightweight' take on such a service, doing the things that I need and that work in a docker/kubernetes environment. By just adding some parameters to the request URL you can control the HTTP-response code, headers and even add a (small) response body.
- Requests persisted in memory
- Websockets will push updates to connected clients
- By default an HTTP/200 OK is returned. If you want something else just add the response status code before the bucket id.
- GET, POST, PUT, DELETE
Create a new bucket by doing a simple get to /ui/{some-new-guid} or by using the 'button' on /ui
https://somehost/ui/{BUCKET-GUID}
https://somehost/{HTTP-RESPOSNE-CODE}/{BUCKET-GUID}/{whatever-url}
Example: HTTP GET/POST/PUT/DELETE to URL
https://somehost/405/fe6d3ace-538c-41c3-8141-c9203ab6efb0/foo/bar
This would log the request and return
- HTTP/405
- Empty body
https://somehost/{HTTP-RESPOSNE-CODE}/{BASE64-ENCODED-LIST-OF '|' SEPARATED-HTTP-HEADERS}/{BASE64-ENCODED-RESPONSE-BODY}/{BUCKET-GUID}/{whatever-url}
Example: HTTP GET/POST/PUT/DELETE to URL
https://somehost/201/Q29udGVudC10eXBlPWFwcGxpY2F0aW9uL2pzb24=/eyJpY2VjcmVhbXRydWNrIiA6IHRydWV9/fe6d3ace-538c-41c3-8141-c9203ab6efb0/foo
The would log the request and return
- HTTP/201
- Content-type: application/json
- Response body {"icecreamtruck" : true}
Note that this only work for small payloads as a typical max request URL is 2Mb. Base64 encoding adds ~30% but something like a 1Mb response body should work fine in most scenarios.
This is an example how to troubleshoot Basic authentication issues. Say you want to capture a request and investigate if the Basic Authentication header was set as expected. Some platforms will not add basic authentication headers to outgoing messages if the service does not conform 100% to the Basic Authentication specification and returns a 401 with header "WWW-Authenticate: Basic".
Using HttpBucket you can have it return a 401 header "WWW-Authenticate: Basic". You will then end up with two calls to the Bucket where the second one should contain the Authorization header.
https://somehost/401/V1dXLUF1dGhlbnRpY2F0ZT1CYXNpYw==/dGVzdC1yZXNwb25zZQ==/07aa6c39-ae94-4efc-b932-4039c2b3ed6e/bar
- Dotnet 5.0 and Asp.Net Core 5
- SignalR Core
docker run -p 8080:80 magohl/httpbucket:latest
Run in docker behind one (or more) reverse proxies docker run -p 8080:80 -e ASPNETCORE_FORWARDEDHEADERS_ENABLED=true magohl/httpbucket:latest
- Clean bucket button
- OIDC login to create/view buckets
- Simple DB backend
- A new and better request header display
Return headers and response body based on request input