diff options
-rw-r--r-- | wsgitools/filters.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/wsgitools/filters.py b/wsgitools/filters.py index f892381..cfa6c36 100644 --- a/wsgitools/filters.py +++ b/wsgitools/filters.py @@ -144,9 +144,14 @@ class WSGIFilterMiddleware: [filter.filter_data(data) for data in ret] + list(filter.append_data())) ret = iter(ret) + def late_append_data(): + """Invoke filter.append_data() after filter_data() has seen all + data.""" + for data in filter.append_data(): + yield data return CloseableIterator(modified_close, (filter.filter_data(data) for data in ret), - filter.append_data()) + late_append_data()) __all__.append("RequestLogWSGIFilter") class RequestLogWSGIFilter(BaseWSGIFilter): |