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(oauth2) Issue with application/json GET requests #1773

Conversation

florent-babylon
Copy link

Hello Kong maintainers,
Side note -- I've tried to be a good open source citizen, but getting a Kong development environment turned out to be too time consuming for this project, therefore I can't provide tests for this PR, besides my word that it's working for us.

Summary

We've noticed an issue in the OAuth2 plugin that would return a server error on HTTP GET requests of content-type application/json. This commit fixes it.

Full changelog

  • Fix OAuth2 plugin for GET requests with a content-type of application/json

Issues resolved

GET requests can come through with a content-type of 'application/json',
but will lack a body. The existing code will break on this case, by
trying to parse a body that doesn't exist -- this commit adds the
condition that the body must exist before we try parsing it.

GET requests can come through with a content-type of 'application/json',
but will lack a body. The existing code will break on this case, by
trying to parse a body that doesn't exist -- this commit adds the
condition that the body must exist before we try parsing it.
@florent-babylon
Copy link
Author

(PS: please let me know if I can help further with getting this PR merged)

@PGBI
Copy link

PGBI commented Nov 3, 2016

We are also getting reports from clients who get 500 response on GET requests. Turns out they were passing the "Content-Type: application/json" header on GET requests.

Although they should not pass this header on GET requests, returning a 500 is nevertheless a bit rude :)

@florent-babylon
Copy link
Author

This has been fixed by #1915

Thanks everybody!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants