Re: [flask] Flask Behavior With Iterators and response objects
- From:
- Simon Sapin
- Date:
- 2011-12-07 @ 08:22
Le 06/12/2011 19:53, Colin L Rice a écrit :
> Hello,
>
> I was wondering exactly how flask deals with iterators inside response
> objects. Does it send a http response for each item in the iterator or
> does it send them down the wire inside of one response?
>
> -Colin
Hi,
See the Flask documentation and the WSGI specification:
http://flask.pocoo.org/docs/patterns/streaming/
http://www.python.org/dev/peps/pep-3333/#buffering-and-streaming
Each response object is one HTTP response. (There can not be more
responses than requests in standard HTTP.) Each item in the iterator is
normally sent over the network without delay (unless a middleware breaks
that).
Regards,
--
Simon Sapin