Merge "have tempurl allow OPTIONS requests"
This commit is contained in:
commit
c3e6f3a1d6
@ -236,6 +236,8 @@ class TempURL(object):
|
||||
:param start_response: The WSGI start_response hook.
|
||||
:returns: Response as per WSGI.
|
||||
"""
|
||||
if env['REQUEST_METHOD'] == 'OPTIONS':
|
||||
return self.app(env, start_response)
|
||||
temp_url_sig, temp_url_expires, filename = self._get_temp_url_info(env)
|
||||
if temp_url_sig is None and temp_url_expires is None:
|
||||
return self.app(env, start_response)
|
||||
|
@ -80,6 +80,7 @@ class TestTempURL(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.app = FakeApp()
|
||||
self.auth = tempauth.filter_factory({})(self.app)
|
||||
self.auth.reseller_prefix = 'a'
|
||||
self.tempurl = tempurl.filter_factory({})(self.auth)
|
||||
|
||||
def _make_request(self, path, **kwargs):
|
||||
@ -92,6 +93,13 @@ class TestTempURL(unittest.TestCase):
|
||||
self.assertEquals(resp.status_int, 401)
|
||||
self.assertTrue('Temp URL invalid' not in resp.body)
|
||||
|
||||
def test_allow_options(self):
|
||||
self.app.status_headers_body_iter = iter([('200 Ok', {}, '')])
|
||||
resp = self._make_request(
|
||||
'/v1/a/c/o?temp_url_sig=abcde&temp_url_expires=12345',
|
||||
environ={'REQUEST_METHOD': 'OPTIONS'}).get_response(self.tempurl)
|
||||
self.assertEquals(resp.status_int, 200)
|
||||
|
||||
def test_get_valid(self):
|
||||
method = 'GET'
|
||||
expires = int(time() + 86400)
|
||||
|
Loading…
Reference in New Issue
Block a user