fix(falcon.testing): create_environ does not support None header values
This patch makes it so that you can pass in a headers dict with individual headers that contain None, and those will translate to the empty string.
This commit is contained in:
@@ -132,9 +132,14 @@ def _add_headers_to_environ(env, headers):
|
||||
for name, value in headers.items():
|
||||
name = name.upper().replace('-', '_')
|
||||
|
||||
if name == 'CONTENT_TYPE':
|
||||
env[name] = value.strip()
|
||||
elif name == 'CONTENT_LENGTH':
|
||||
env[name] = value.strip()
|
||||
if value is None:
|
||||
value = ''
|
||||
else:
|
||||
env['HTTP_' + name.upper()] = value.strip()
|
||||
value = value.strip()
|
||||
|
||||
if name == 'CONTENT_TYPE':
|
||||
env[name] = value
|
||||
elif name == 'CONTENT_LENGTH':
|
||||
env[name] = value
|
||||
else:
|
||||
env['HTTP_' + name.upper()] = value
|
||||
|
||||
Reference in New Issue
Block a user