mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 23:00:18 +00:00
Use header Origin in response headers when available
Since the RFC [1] doesn't allow wildcards for credentialed requests, add the requested Origin into the response headers. [1] https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS#Requests_with_credentials
This commit is contained in:
committed by
Rodrigo Chacon
parent
3f45aba2af
commit
e3cd47d0e2
@@ -45,6 +45,10 @@ class HttpbinTestCase(unittest.TestCase):
|
||||
response = self.app.get('/get')
|
||||
self.assertEquals(response.headers.get('Access-Control-Allow-Origin'), '*')
|
||||
|
||||
def test_set_cors_headers_after_request_with_request_origin(self):
|
||||
response = self.app.get('/get', headers={'Origin': 'origin'})
|
||||
self.assertEquals(response.headers.get('Access-Control-Allow-Origin'), 'origin')
|
||||
|
||||
def test_set_cors_headers_with_options_verb(self):
|
||||
response = self.app.open('/get', method='OPTIONS')
|
||||
self.assertEquals(response.headers.get('Access-Control-Allow-Origin'), '*')
|
||||
|
||||
Reference in New Issue
Block a user