Skip to content

Wrap StarletteRequestExtractor in capture_internal_exceptions#1551

Merged
sl0thentr0py merged 1 commit intomasterfrom
neel/safe-extract-info-fastapi
Aug 8, 2022
Merged

Wrap StarletteRequestExtractor in capture_internal_exceptions#1551
sl0thentr0py merged 1 commit intomasterfrom
neel/safe-extract-info-fastapi

Conversation

@sl0thentr0py
Copy link
Copy Markdown
Member

@sl0thentr0py sl0thentr0py commented Aug 8, 2022

Fixes #1550

If the header type is not consistent with the body, the SDK currently throws internally.

before

(venv) ➜  fastapi git:(main) ✗ curl -X 'POST' \
  'http://localhost:8000/token' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d 'grant_type=&username=johndoe&password=secret&scope=&client_id=&client_secret='
Internal Server Error

after

(venv) ➜  fastapi git:(main) ✗ curl -X 'POST' \
  'http://localhost:8000/token' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d 'grant_type=&username=johndoe&password=secret&scope=&client_id=&client_secret='
{"detail":[{"loc":["body","username"],"msg":"field required","type":"value_error.missing"},{"loc":["body","password"],"msg":"field required","type":"value_error.missing"}]}%

@sl0thentr0py sl0thentr0py marked this pull request as ready for review August 8, 2022 11:50
@sl0thentr0py sl0thentr0py merged commit 89c800b into master Aug 8, 2022
@sl0thentr0py sl0thentr0py deleted the neel/safe-extract-info-fastapi branch August 8, 2022 12:23
@mdczaplicki
Copy link
Copy Markdown

Hey, any ETA for new patch version?

@vladanpaunovic
Copy link
Copy Markdown
Contributor

@mdczaplicki, we submitted a release, you can follow it up here getsentry/publish#1283

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.

JSONDecodeError Expecting value: line 1 column 1 (char 0) (StarletteIntegration)

3 participants