diff --git a/httpbin/core.py b/httpbin/core.py index 24187be..602378f 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -240,7 +240,7 @@ def stream_n_messages(n): }) -@app.route('/status/') +@app.route('/status/', methods=['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'TRACE']) def view_status_code(codes): """Return status code or random status code if more than one are given""" diff --git a/test_httpbin.py b/test_httpbin.py index 8f52ea8..7b3274a 100755 --- a/test_httpbin.py +++ b/test_httpbin.py @@ -169,6 +169,19 @@ class HttpbinTestCase(unittest.TestCase): ) assert json.loads(response.data.decode('utf-8'))['form'] == {'name':'kevin'} + def test_methods__to_status_endpoint(self): + methods = [ + 'GET', + 'HEAD', + 'POST', + 'PUT', + 'DELETE', + 'PATCH', + 'TRACE', + ] + for m in methods: + response = self.app.open(path='/status/418', method=m) + self.assertEqual(response.status_code, 418) if __name__ == '__main__': unittest.main()