Skip to content

Conversation

@pugnascotia
Copy link
Contributor

Closes #49428. The code that works out an HTTP code for an exception didn't consider the JsonParseException case, meant that an invalid JSON request could result in a 500 Internal Server Error. Now it returns 400 Bad Request.

@pugnascotia pugnascotia added >bug :Core/Infra/REST API REST infrastructure and utilities v8.0.0 labels Nov 25, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/REST API)

Copy link
Member

@jaymode jaymode left a comment

Choose a reason for hiding this comment

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

LGTM. Given that this is a bug fix shouldn't we target to 7.x as well?

@pugnascotia
Copy link
Contributor Author

Oops, yes, that's an oversight on my part.

@pugnascotia
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/packaging-sample-matrix due to transient error

@pugnascotia pugnascotia merged commit fc33ee4 into elastic:master Nov 25, 2019
@pugnascotia pugnascotia deleted the 49428-invalid-json-400-response branch November 25, 2019 17:15
pugnascotia added a commit to pugnascotia/elasticsearch that referenced this pull request Nov 25, 2019
Closes elastic#49428. The code that works out an HTTP code for an exception didn't
consider the JsonParseException case, meant that an invalid JSON request could
result in a 500 Internal Server Error. Now it returns 400 Bad Request.
pugnascotia added a commit that referenced this pull request Nov 26, 2019
Backport of #49552.

Closes #49428. The code that works out an HTTP code for an exception didn't
consider the JsonParseException case, meant that an invalid JSON request could
result in a 500 Internal Server Error. Now it returns 400 Bad Request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid JSON request bodies result in 500 response

4 participants