Skip to content

Conversation

Kludex
Copy link
Member

@Kludex Kludex commented Mar 14, 2025

No description provided.

response = Response("Could not find session", status_code=404)
return await response(scope, receive, send)

json = await request.json()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The json() calls the json module, we can just use the body, and Pydantic's model_validate_json. It's faster.

@Kludex Kludex requested a review from dsp-ant March 14, 2025 12:56
Copy link
Member

@dsp-ant dsp-ant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL!

@dsp-ant dsp-ant merged commit c897868 into main Mar 14, 2025
5 checks passed
@dsp-ant dsp-ant deleted the avoid-double-json-encoding branch March 14, 2025 15:08
@samuelcolvin
Copy link
Member

nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants