Skip to content

fix(integration): fix FlaskIntegration for Werkzeug > 2.1.0#1939

Merged
antonpirker merged 2 commits intogetsentry:masterfrom
michielderoos:patch-1
Mar 3, 2023
Merged

fix(integration): fix FlaskIntegration for Werkzeug > 2.1.0#1939
antonpirker merged 2 commits intogetsentry:masterfrom
michielderoos:patch-1

Conversation

@michielderoos
Copy link
Copy Markdown
Contributor

As explained in this bug report, recent versions of werkzeug introduced the behaviour to get_json where it will throw an error when content_type isn't set.

@michielderoos michielderoos changed the title Update get_json function call for werkzeug 2.1.0+ fix(integration): fix FlaskIntegration for Werkzeug > 2.1.0 Mar 2, 2023
@cc-jj
Copy link
Copy Markdown

cc-jj commented Mar 3, 2023

Fixes: #1936

Copy link
Copy Markdown
Contributor

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

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

So in old Werkzeug doing .get_json() never resulted in an error and now an error will be thrown unless you add .get_json(silent=True) which then makes get_json behave like in the old Werkzeug? Is this correct?

@michielderoos
Copy link
Copy Markdown
Contributor Author

michielderoos commented Mar 3, 2023

So in old Werkzeug doing .get_json() never resulted in an error and now an error will be thrown unless you add .get_json(silent=True) which then makes get_json behave like in the old Werkzeug? Is this correct?

@antonpirker Yes, exactly correct! And this is backwards compatible with old versions of Werkzeug as well, silent=true isn't new with their breaking change.

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