postmanlabs / httpbin

HTTP Request & Response Service, written in Python + Flask.
https://httpbin.org
ISC License
12.71k stars 1.8k forks source link

Include body in /status responses #627

Open greenmooseSE opened 3 years ago

greenmooseSE commented 3 years ago

To test reading response body for status codes I would like an option for httpbin to return a body in the response, either by default or e.g. by using query string parameter https://httpbin.org/status/500?body=SomeBody

(In comparison, httpstat.us returns a plain text body if no accept header is given, and a application/json body if accept: application/json header is supplied. See below for example image )

peterlundberg commented 2 years ago

Agree that this would be useful. For example to validate that 400 status messages with a json response detailing the reason it was a bad request can be handled.

Another option could be to support combinations like https://httpbin.org/status/500/json