Feature: Allow HTTP Digest Auth#1
Open
subzero10 wants to merge 2 commits into
Open
Conversation
Owner
|
Thanks for the PR! Generally speaking, I'd rather like to not replace node-fetch with something else, especially as fetch is finally supported in Node 18, so eventually I'd like to actually remove it, and use native fetch instead. I could not really find that much information about digest auth, to be honest, and don't really have any experience with it. So in order to rather keep this a bit separate, I'd prefer to handle this a bit differently:
This way, we can enapsulate this a bit. So simplified speaking, New options:
function makeFetchRequest() {
if (authUser && authPassword) {
let client = new DigestFetch(authUser, authPassword, , { basic: !useDigestAuth });
return client.fetch(url, options);
}
return fetch(url, options);
}
async function doFetch() {
let response = await makeFetchRequest();
// etc.
}Also please make sure to not change the formatting, and I use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for this Github Action!
I am using it to call an API that requires HTTP Digest. This PR replaces
node-fetchwithurllib, which supports HTTP Digest out-of-the-box.Tests pass without any other changes 👌
Note:
npm run build, ncc generates more than one file, however it works fine.