blob: 517f730afbce28e6ee842a732fb2691cc032ec09 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
def modify(chunks):
"""
chunks is a generator that can be used to iterate over all chunks.
Each chunk is a (prefix, content, suffix) tuple.
For example, in the case of chunked transfer encoding: ("3\r\n","foo","\r\n")
"""
for prefix, content, suffix in chunks:
yield prefix, content.replace("foo","bar"), suffix
def responseheaders(ctx, flow):
flow.response.stream = modify
|