fix(Response): Sets default OPTIONS responder Content-Length to 0 (#801)
* fix(Response): Sets default OPTIONS responder Content-Length to 0 Closes #796 * test(Response): Added test to check default content-length header for OPTIONS Request It checks that the content-length header for options request is 0. Closes #796
This commit is contained in:
committed by
John Vrbanac
parent
8be4ced587
commit
5ef11c505a
@@ -58,5 +58,6 @@ def create_default_options(allowed_methods):
|
||||
def on_options(req, resp, **kwargs):
|
||||
resp.status = HTTP_204
|
||||
resp.set_header('Allow', allowed)
|
||||
resp.set_header('Content-Length', '0')
|
||||
|
||||
return on_options
|
||||
|
||||
@@ -534,6 +534,12 @@ class TestHeaders(testing.TestCase):
|
||||
|
||||
self._check_link_header(resource, expected_value)
|
||||
|
||||
def test_content_length_options(self):
|
||||
result = self.simulate_options()
|
||||
|
||||
content_length = '0'
|
||||
self.assertEqual(result.headers['Content-Length'], content_length)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Helpers
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user