Skip to content

Commit

Permalink
Only bail out of body is not expected
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavsingh committed Nov 6, 2021
1 parent d9200fd commit 2ef3b92
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions proxy/plugin/modify_chunk_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ def handle_upstream_chunk(self, chunk: memoryview) -> memoryview:
self.response.parse(chunk.tobytes())
# If response is complete, modify and dispatch to client
if self.response.state == httpParserStates.COMPLETE:
# Avoid setting a body for responses where content is not expected
if self.response.content_expected():
# Avoid setting a body for responses where a body is not expected.
# Otherwise, example curl will report warnings.
if self.response.body_expected():
self.response.body = b'\n'.join(self.DEFAULT_CHUNKS) + b'\n'
self.client.queue(memoryview(self.response.build_response()))
return memoryview(b'')
Expand Down

0 comments on commit 2ef3b92

Please sign in to comment.