I would like to create a simple server using nc
or python -m SimpleHttpServer
that would throw a 400 and send a JSON response which I could use to test error handling. I've tried httpbin.org/status/400
but that only comes back with a status code but no response.
Try this:
while true; do { echo -e "HTTP/1.1 400 Bad Request\n\n{\"foo\": \"bar\"}"; } | nc -l 8080; done