Merge "Keep user id and project id in subrequests env"
This commit is contained in:
commit
2a1558a907
@ -1090,7 +1090,7 @@ def make_env(env, method=None, path=None, agent='Swift', query_string=None,
|
||||
'HTTP_ORIGIN', 'HTTP_ACCESS_CONTROL_REQUEST_METHOD',
|
||||
'SERVER_PROTOCOL', 'swift.cache', 'swift.source',
|
||||
'swift.trans_id', 'swift.authorize_override',
|
||||
'swift.authorize'):
|
||||
'swift.authorize', 'HTTP_X_USER_ID', 'HTTP_X_PROJECT_ID'):
|
||||
if name in env:
|
||||
newenv[name] = env[name]
|
||||
if method:
|
||||
|
@ -816,6 +816,16 @@ class TestWSGI(unittest.TestCase):
|
||||
self.assertEquals(r.environ['SCRIPT_NAME'], '')
|
||||
self.assertEquals(r.environ['PATH_INFO'], '/override')
|
||||
|
||||
def test_make_env_keep_user_project_id(self):
|
||||
oldenv = {'HTTP_X_USER_ID': '1234', 'HTTP_X_PROJECT_ID': '5678'}
|
||||
newenv = wsgi.make_env(oldenv)
|
||||
|
||||
self.assertTrue('HTTP_X_USER_ID' in newenv)
|
||||
self.assertEquals(newenv['HTTP_X_USER_ID'], '1234')
|
||||
|
||||
self.assertTrue('HTTP_X_PROJECT_ID' in newenv)
|
||||
self.assertEquals(newenv['HTTP_X_PROJECT_ID'], '5678')
|
||||
|
||||
|
||||
class TestServersPerPortStrategy(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user