HttpResponse

Passing iterators

Finally, you can pass HttpResponse an iterator rather than strings. HttpResponse will consume the iterator immediately, store its content as a string, and discard it. Objects with a close() method such as files and generators are immediately closed.

If you need the response to be streamed from the iterator to the client, you must use the StreamingHttpResponseclass instead.

References

[1] [email protected], HttpResponse objects

[2] [email protected], #6527 A bug in HttpResponse with iterators

results matching ""

    No results matching ""