digest-fetch
digest-fetch copied to clipboard
digest auth request plugin for fetch/node-fetch
From the `node-fetch` [readme](https://www.npmjs.com/package/node-fetch): > `node-fetch` from v3 is an ESM-only module - you are not able to import it with `require()`. Which basically means I can't use `node-fetch@v3` and...
Split WWW-Authenticate by challenge and handle digest-related properties only for digest method. Add tests to make sure Digest is chosen as the more secure variant.
parseAuth expects a full WWW-Authenticate header value which includes the scheme, so it makes sense to provide it in tests.
Asynchronous tests need to run the 'done' function supplied as their argument; otherwise they are considered passing prematurely.
Any plans to add typescript support?
If you want to use the package in a Typescript project, without getting in trouble: you should use the following way to import it `import DigestClient = require('digest-fetch');`
`DigestClient.prototype.fetch` is currently expecting its arguments to be in the form `(url: string, init: RequestInit)`, but the fetch API also supports arguments in the form of `(request: RequestInfo, init: undefined)`....
Apologies for all the changes below, vs code started formatting everything! I'm trying to add a timeout option to the fetch as I've ran into a weird networking issue calling...