-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
replace got with undici #352
base: master
Are you sure you want to change the base?
Conversation
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/[email protected] |
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.
LGTM! I like the idea of using undici in this scenario 👍
Co-authored-by: Ulises Gascón <[email protected]>
Not sure why the coverage is failing, but does not seems related (IMO) https://github.com/jshttp/mime-db/actions/runs/12635017301/job/35239389864?pr=352 |
var mime = extractTemplateMime(body) | ||
|
||
// add the template as a source | ||
addSource(data, res.url) |
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.
Im not sure that we are getting redirects from IANA, but the two previous http clients being used would follow redirects if we got them. So the res.url
here was functional in that sense, it would resolve to whatever location the server redirected us to vs the url we initiated a request to.
Something to keep in mind here, if we did get a redirect we'd break or otherwise drop the data. Hopefully we'd notice that in the diff.
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.
Undici does not provide the url
property, so I had to create a variable and update it manually to replicate the behavior.
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.
We're also no longer receiving redirects since I changed the URL that was causing the redirect in:
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.
@jonchurch do you consider this resolved? If so I would like to merge this.
Unlike what #347 does, got is replaced with undici, avoiding the use of try-catch, with the same result. It might improve the workflow speed, but that's the least important thing (in my opinion).