mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 23:00:18 +00:00
+1
-1
@@ -240,7 +240,7 @@ def stream_n_messages(n):
|
||||
})
|
||||
|
||||
|
||||
@app.route('/status/<codes>')
|
||||
@app.route('/status/<codes>', 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"""
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user