tomas / needle

Nimble, streamable HTTP client for Node.js. With proxy, iconv, cookie, deflate & multipart support.
https://www.npmjs.com/package/needle
MIT License
1.63k stars 236 forks source link

Use .netrc for preconfigured authentication #334

Open raspy opened 4 years ago

raspy commented 4 years ago

Frequently authentication needs to be configured outside the code. Quite standard approach in Unix world is to store those credentials in ~/.netrc and this is widely supported in HTTP clients, i.e. wget, curl or python-requests. Please include support for auto-reading credentials from ~/.netrc as well (I believe there is an npm module for parsing that).

tomas commented 4 years ago

I'd be happy to merge this if you submit a PR, as long as reading/parsing that file is optional (eg if { use_netrc: true } is present).