kennethreitz/httpbin — pull request #68 by kencochrane (2012-10-18 00:21:45+00:00)
Title: Added new endpoint /data/status/<code> and also allowed POST to /status/<code>

I'm writing unit tests for a API client and there are some cases where the API will return different HTTP status codes when POSTing and GETing to the API, and in order to fully these these, I needed the ability to POST and GET to httpbin, and also specify what HTTP status code I'm going to get back.

I made two changes to allow me to get this done.

1. I allowed POST to the /status/[code] endpoint. Before it only allowed GET requests.

2. I created a new endpoint called /data/status/[code] If you have a better name, feel free to rename. The new endpoint acts just like the POST and GET endpoints but it also allows you to specify the HTTP status code returned.

I originally had these as two different endpoints, but merged them together since they were identical, if you prefer these to be different /post/status/[code] and /get/status/[code] let me know and I'll break them out again.

I added some minor documentation to the README.md if you want more, let me know. I also looked at the unit tests, but there didn't seem to be many, and I wasn't sure how I would test this. If you need unit tests, please let me know.

I tired to make my changes as small as possible, so I wouldn't break anything else. If you have any questions, please let me know.

Thanks,
Ken Cochrane