Skip to content

Commit

Permalink
Fix Inner bug: TypeError: __init__() got an unexpected keyword argume…
Browse files Browse the repository at this point in the history
…nt 'escape_forward_slashes' sanic-org#2740 (sanic-org#2772)
  • Loading branch information
chidoben authored and moshe742 committed Jul 8, 2023
1 parent fd14a45 commit 585fb41
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/request_stream/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
for i in range(1, 250000):
data += str(i)

r = requests.post('http://0.0.0.0:8000/stream', data=data)
r = requests.post("http://0.0.0.0:8000/stream", data=data)
print(r.text)
4 changes: 3 additions & 1 deletion sanic/response/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@


try:
from ujson import dumps as json_dumps
from ujson import dumps as ujson_dumps

json_dumps = partial(ujson_dumps, escape_forward_slashes=False)
except ImportError:
# This is done in order to ensure that the JSON response is
# kept consistent across both ujson and inbuilt json usage.
Expand Down
5 changes: 1 addition & 4 deletions sanic/worker/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ async def _info(self, request: Request):

async def _respond(self, request: Request, output: Any):
name = request.match_info.get("action", "info")
return json(
{"meta": {"action": name}, "result": output},
escape_forward_slashes=False,
)
return json({"meta": {"action": name}, "result": output})

def _state_to_json(self) -> Dict[str, Any]:
output = {"info": self.app_info}
Expand Down

0 comments on commit 585fb41

Please sign in to comment.