-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
migrate request --> got in [github] auth acceptor #7248
Conversation
@@ -60,7 +60,6 @@ | |||
"prom-client": "^14.0.1", | |||
"qs": "^6.10.1", | |||
"query-string": "^7.0.1", | |||
"request": "~2.88.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
form: { | ||
// TODO The `_user` and `_pass` properties bypass security checks in | ||
// AuthHelper (e.g: enforceStrictSsl and shouldAuthenticateRequest). | ||
// Do not use them elsewhere. It would be better to clean | ||
// this up so it's not setting a bad example. | ||
client_id: authHelper._user, | ||
client_secret: authHelper._pass, | ||
code: data.code, | ||
}), | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guess got
will handle the query param mappings for us?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. By default got will use URL encoding for the form
object. It will also set the content-type header to application/x-www-form-urlencoded
, but I left the custom header with the ;charset=UTF-8
in place.
The "a code is provided" test case decodes the request body with queryString.parse()
to make assertions about it, so that behaviour is covered under test.
Refs #4655
This PR moves our last remaining module that calls request to use got instead. That said, I have quite a few mop-up tasks to fully "complete" the job. We're making progress though :)
A lot of this diff is just indenting changes due to callback --> async/await. Also improved the tests slightly.