diff --git a/lyrebird/mock/handlers/flow_editor_handler.py b/lyrebird/mock/handlers/flow_editor_handler.py index 99d3f237..88b5c2f5 100644 --- a/lyrebird/mock/handlers/flow_editor_handler.py +++ b/lyrebird/mock/handlers/flow_editor_handler.py @@ -50,7 +50,7 @@ def on_response_handler(self, handler_context): handler_context.flow['response']['code'] = 200 if not handler_context.flow['response'].get('headers'): handler_context.flow['response']['headers'] = {} - if not handler_context.flow['response'].get('data'): + if 'data' not in handler_context.flow['response']: if handler_context.response: handler_context.update_response_data2flow() else: diff --git a/lyrebird/mock/handlers/handler_context.py b/lyrebird/mock/handlers/handler_context.py index 850e317e..3dcdcf78 100644 --- a/lyrebird/mock/handlers/handler_context.py +++ b/lyrebird/mock/handlers/handler_context.py @@ -309,8 +309,10 @@ def update_client_resp_time(self): resp_data = self.flow['response'].get('data', '') if isinstance(resp_data, str): self.flow['size'] = len(resp_data.encode()) - else: + elif resp_data: self.flow['size'] = len(resp_data) + else: + self.flow['size'] = 0 self.flow['duration'] = self.server_resp_time - self.client_req_time