Skip to content

Commit

Permalink
fix mock handler not change keep-request-body flag when set ssr (#832)
Browse files Browse the repository at this point in the history
  • Loading branch information
noO0oOo0ob committed Mar 8, 2024
1 parent b5a523f commit 5d6e2af
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lyrebird/mock/handlers/flow_editor_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def on_request_handler(self, handler_context):
return

self.script_executor(matched_funcs, handler_context.flow)
handler_context.set_request_edited()
handler_context.set_request_edited(handler_context.flow.get('keep_origin_request_body', False))
handler_context.flow['request']['headers']['lyrebird_modified'] = 'modified'

def on_request_upstream_handler(self, handler_context):
Expand Down
3 changes: 2 additions & 1 deletion lyrebird/mock/handlers/handler_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ def _read_origin_request_info_from_header(self, headers=None):
path=self.request.path[len(self.MOCK_PATH_PREFIX):]
)

def set_request_edited(self):
def set_request_edited(self, keep_origin_request_body=False):
self.flow['keep_origin_request_body'] = self.flow.get('keep_origin_request_body', False) and keep_origin_request_body
self.is_request_edited = True

def set_response_edited(self):
Expand Down
2 changes: 1 addition & 1 deletion lyrebird/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
IVERSION = (2, 25, 2)
IVERSION = (2, 25, 3)
VERSION = ".".join(str(i) for i in IVERSION)
LYREBIRD = "Lyrebird " + VERSION

0 comments on commit 5d6e2af

Please sign in to comment.