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(3063): Logging middleware with structlog causes application to return HTTP 500 when request body is malformed #3109

Merged
merged 4 commits into from
Feb 14, 2024

Conversation

provinzkraut
Copy link
Member

@provinzkraut provinzkraut commented Feb 13, 2024

Gracefully handle malformed request bodies during parsing when using struclog. Instead of erroring out and returning a 500, simply use the raw body.

Fixes #3063.

@provinzkraut provinzkraut requested review from a team as code owners February 13, 2024 19:06
@provinzkraut provinzkraut changed the title fix(3036: Logging middleware with structlog causes application to return HTTP 500 when request body is malformed fix(3036): Logging middleware with structlog causes application to return HTTP 500 when request body is malformed Feb 13, 2024
@provinzkraut provinzkraut force-pushed the fix-3036-body-parsing-with-structlog branch from 61d8008 to d8f7989 Compare February 13, 2024 19:07
@provinzkraut provinzkraut changed the title fix(3036): Logging middleware with structlog causes application to return HTTP 500 when request body is malformed fix(3063): Logging middleware with structlog causes application to return HTTP 500 when request body is malformed Feb 13, 2024
@provinzkraut provinzkraut force-pushed the fix-3036-body-parsing-with-structlog branch from d8f7989 to 2771a53 Compare February 14, 2024 11:02
@provinzkraut provinzkraut force-pushed the fix-3036-body-parsing-with-structlog branch from a9ad825 to 795addb Compare February 14, 2024 11:48
Copy link

codecov bot commented Feb 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (67ab44d) 98.26% compared to head (159a98f) 98.26%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3109   +/-   ##
=======================================
  Coverage   98.26%   98.26%           
=======================================
  Files         320      320           
  Lines       14373    14387   +14     
  Branches     2310     2313    +3     
=======================================
+ Hits        14123    14137   +14     
  Misses        109      109           
  Partials      141      141           

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

Copy link

sonarcloud bot commented Feb 14, 2024

@provinzkraut provinzkraut merged commit e137a96 into main Feb 14, 2024
20 checks passed
@provinzkraut provinzkraut deleted the fix-3036-body-parsing-with-structlog branch February 14, 2024 14:05
Copy link

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

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.

Bug: Logging middleware with structlog causes application to return HTTP 500 when request body is malformed
2 participants