Skip to content

Commit

Permalink
keep original request body when the request is mocked and diff_mode i… (
Browse files Browse the repository at this point in the history
#800)

* keep original request body when the request is mocked and diff_mode is enabled

* use flow['origin_request']

---------

Co-authored-by: yangfan100 <[email protected]>
  • Loading branch information
echoyang7 and yangfan100 authored Nov 9, 2023
1 parent c37d86d commit afcae22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lyrebird/mock/handlers/handler_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ def get_request_body(self, in_request_handler=True):
else:
if in_request_handler:
_data = self.request.data or self.request.form or None
# When origin_request is not saved, the original data cannot be obtained when diff-mode is enabled.
elif self.flow.get('origin_request', {}).get('data'):
_data = self.flow.get('origin_request', {}).get('data')
else:
_data = DataHelper.flow2origin(self.flow['request'])
return _data
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, 21, 0)
IVERSION = (2, 21, 1)
VERSION = ".".join(str(i) for i in IVERSION)
LYREBIRD = "Lyrebird " + VERSION

0 comments on commit afcae22

Please sign in to comment.