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

Method get_app_iter

src/werkzeug/wrappers/response.py:520–545  ·  view source on GitHub ↗

Returns the application iterator for the given environ. Depending on the request method and the current status code the return value might be an empty response rather than the one from the response. If the request method is `HEAD` or the status code is in a range wh

(self, environ: WSGIEnvironment)

Source from the content-addressed store, hash-verified

518 return headers
519
520 def get_app_iter(self, environ: WSGIEnvironment) -> t.Iterable[bytes]:
521 """Returns the application iterator for the given environ. Depending
522 on the request method and the current status code the return value
523 might be an empty response rather than the one from the response.
524
525 If the request method is `HEAD` or the status code is in a range
526 where the HTTP specification requires an empty response, an empty
527 iterable is returned.
528
529 .. versionadded:: 0.6
530
531 :param environ: the WSGI environment of the request.
532 :return: a response iterable.
533 """
534 status = self.status_code
535 if (
536 environ["REQUEST_METHOD"] == "HEAD"
537 or 100 <= status < 200
538 or status in (204, 304)
539 ):
540 iterable: t.Iterable[bytes] = ()
541 elif self.direct_passthrough:
542 return self.response # type: ignore
543 else:
544 iterable = self.iter_encoded()
545 return ClosingIterator(iterable, self.close)
546
547 def get_wsgi_response(
548 self, environ: WSGIEnvironment

Callers 1

get_wsgi_responseMethod · 0.95

Calls 2

iter_encodedMethod · 0.95
ClosingIteratorClass · 0.85

Tested by

no test coverage detected