MCPcopy
hub / github.com/pallets/werkzeug / get_content_length

Function get_content_length

src/werkzeug/wsgi.py:128–140  ·  view source on GitHub ↗

Return the ``Content-Length`` header value as an int. If the header is not given or the ``Transfer-Encoding`` header is ``chunked``, ``None`` is returned to indicate a streaming request. If the value is not an integer, or negative, 0 is returned. :param environ: The WSGI environ to get

(environ: WSGIEnvironment)

Source from the content-addressed store, hash-verified

126
127
128def get_content_length(environ: WSGIEnvironment) -> int | None:
129 """Return the ``Content-Length`` header value as an int. If the header is not given
130 or the ``Transfer-Encoding`` header is ``chunked``, ``None`` is returned to indicate
131 a streaming request. If the value is not an integer, or negative, 0 is returned.
132
133 :param environ: The WSGI environ to get the content length from.
134
135 .. versionadded:: 0.9
136 """
137 return _sansio_utils.get_content_length(
138 http_content_length=environ.get("CONTENT_LENGTH"),
139 http_transfer_encoding=environ.get("HTTP_TRANSFER_ENCODING"),
140 )
141
142
143def get_input_stream(

Callers 2

get_input_streamFunction · 0.70
parse_from_environMethod · 0.70

Calls 1

getMethod · 0.45

Tested by

no test coverage detected