mirror of
https://github.com/zulip/zulip.git
synced 2025-10-30 19:43:47 +00:00
refactor: Parse JSON from bots in one place.
We move the JSON parsing step into the higher level function: process_success_response(). In the unlikely event that we'll start integrating with a solution that doesn't use JSON, we can deal with that, and for now doing the parsing in one place will help us make error reporting more consistent. In a subsequent commit we'll introduce better error handling for malformed JSON.
This commit is contained in:
@@ -27,7 +27,7 @@ def timeout_error(http_method: Any, final_url: Any, data: Any, **request_kwargs:
|
||||
raise requests.exceptions.Timeout("Time is up!")
|
||||
|
||||
class MockServiceHandler(OutgoingWebhookServiceInterface):
|
||||
def process_success(self, response: Response, event: Dict[str, Any]) -> Optional[Dict[str, Any]]:
|
||||
def process_success(self, response_json: Dict[str, Any], event: Dict[str, Any]) -> Optional[Dict[str, Any]]:
|
||||
# Our tests don't really look at the content yet.
|
||||
# They just ensure we use the "success" codepath.
|
||||
success_data = dict(
|
||||
|
||||
Reference in New Issue
Block a user