MCPcopy
hub / github.com/django/django / get_bytes_from_wsgi

Function get_bytes_from_wsgi

django/core/handlers/wsgi.py:187–197  ·  view source on GitHub ↗

Get a value from the WSGI environ dictionary as bytes. key and default should be strings.

(environ, key, default)

Source from the content-addressed store, hash-verified

185
186
187def get_bytes_from_wsgi(environ, key, default):
188 """
189 Get a value from the WSGI environ dictionary as bytes.
190
191 key and default should be strings.
192 """
193 value = environ.get(key, default)
194 # Non-ASCII values in the WSGI environ are arbitrarily decoded with
195 # ISO-8859-1. This is wrong for Django websites where UTF-8 is the default.
196 # Re-encode to recover the original bytestring.
197 return value.encode("iso-8859-1")
198
199
200def get_str_from_wsgi(environ, key, default):

Callers 4

GETMethod · 0.85
get_path_infoFunction · 0.85
get_script_nameFunction · 0.85
get_str_from_wsgiFunction · 0.85

Calls 2

getMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected