Socket
Socket
Sign inDemoInstall

digest-fetch

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

digest-fetch - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

1

digest-fetch-src.js

@@ -35,2 +35,3 @@ const canRequire = typeof(require) == 'function'

addAuth (url, options) {
if (typeof(options.renew) == 'function') options = options.renew()
if (!this.hasAuth) return options

@@ -37,0 +38,0 @@ if (this.logger) this.logger.info(`requesting with auth carried`)

2

package.json
{
"name": "digest-fetch",
"version": "0.0.5",
"version": "0.0.6",
"description": "digest auth request plugin for fetch/node-fetch",

@@ -5,0 +5,0 @@ "main": "digest-fetch-src.js",

@@ -23,3 +23,6 @@ # digest-fetch

const DigestFetch = require('digest-fetch')
const client = DigestFetch('user', 'password', console) // console as logger, optional parameter
// console as logger, optional parameter
const client = DigestFetch('user', 'password', console)
// do request same way as fetch or node-fetch

@@ -33,2 +36,10 @@ const url = ''

// pass in refresh request options function for conditions options needs be refreshed when trying again.
// etc: when posting with file stream
const renew = () => { body: fs.createReadStream('path-to-file') }
client.fetch(url, {renew})
.then(resp=>resp.json())
.then(data=>console.log(data))
.catch(e=>console.error(e))
```

@@ -35,0 +46,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc