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

migrate request --> got in [github] auth acceptor #7248

Merged
merged 1 commit into from
Nov 12, 2021

Conversation

chris48s
Copy link
Member

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.

@chris48s chris48s added service-badge New or updated service badge core Server, BaseService, GitHub auth, Shared helpers dependencies Related to dependency updates labels Nov 11, 2021
@@ -60,7 +60,6 @@
"prom-client": "^14.0.1",
"qs": "^6.10.1",
"query-string": "^7.0.1",
"request": "~2.88.2",
Copy link
Member Author

Choose a reason for hiding this comment

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

🎉

@shields-ci
Copy link

Warnings
⚠️

📚 Remember to ensure any changes to config.private in services/github/auth/acceptor.spec.js are reflected in the server secrets documentation

⚠️

📚 Remember to ensure any changes to config.private in services/github/auth/acceptor.js are reflected in the server secrets documentation

Messages
📖 ✨ Thanks for your contribution to Shields, @chris48s!

Generated by 🚫 dangerJS against 09ad758

Copy link
Member

@calebcartwright calebcartwright left a comment

Choose a reason for hiding this comment

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

👍

Comment on lines +38 to +46
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,
}),
},
Copy link
Member

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?

Copy link
Member Author

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.

@chris48s chris48s merged commit 0e38eab into badges:master Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Server, BaseService, GitHub auth, Shared helpers dependencies Related to dependency updates service-badge New or updated service badge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants