Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Safe Handling of "more_body" in ASGI Responses #3845

Merged
merged 4 commits into from
Oct 30, 2024

Conversation

cemrehancavdar
Copy link
Contributor

Safe Access to "More Body"

I've encountered an issue in sqladmin-litestar-plugin where some ASGI frameworks (such as Starlette) do not include "more_body": false in the "http.response.body" event. According to the ASGI specification, this key should be set to False when there is no additional body content. Litestar expects "more_body" to be explicitly defined, but others might not.

This leads to failures when an ASGI framework mounted on Litestar throws error for the "more_body" key in "http.response.body".

I have changed it to message.get('more_body')as @cofin suggests.

@cemrehancavdar cemrehancavdar requested review from a team as code owners October 30, 2024 16:53
@github-actions github-actions bot added area/middleware This PR involves changes to the middleware size: small pr/external Triage Required 🏥 This requires triage labels Oct 30, 2024
@cemrehancavdar cemrehancavdar changed the title Safe Handling of "more_body" in ASGI Responses fix: Safe Handling of "more_body" in ASGI Responses Oct 30, 2024
@cemrehancavdar cemrehancavdar marked this pull request as draft October 30, 2024 16:57
Copy link

codecov bot commented Oct 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.42%. Comparing base (dcae3b3) to head (24ef67a).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3845   +/-   ##
=======================================
  Coverage   98.42%   98.42%           
=======================================
  Files         333      333           
  Lines       15348    15348           
  Branches     1694     1694           
=======================================
  Hits        15107    15107           
  Misses        111      111           
  Partials      130      130           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3845

@cemrehancavdar cemrehancavdar marked this pull request as ready for review October 30, 2024 17:37
@provinzkraut provinzkraut merged commit ed35b61 into litestar-org:main Oct 30, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/middleware This PR involves changes to the middleware pr/external size: small Triage Required 🏥 This requires triage type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants