Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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

digest auth request plugin for fetch/node-fetch also support http basic auth authentication

  • 3.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
186K
decreased by-64%
Maintainers
1
Weekly downloads
 
Created

What is digest-fetch?

The digest-fetch npm package is a library that provides HTTP Digest Access Authentication for making HTTP requests. It is particularly useful for interacting with APIs that require digest authentication, which is a more secure method compared to basic authentication.

What are digest-fetch's main functionalities?

Basic Usage

This feature demonstrates how to create a DigestFetch client with a username and password, and make a simple authenticated GET request.

const DigestFetch = require('digest-fetch');
const client = new DigestFetch('username', 'password');

client.fetch('http://httpbin.org/digest-auth/auth/user/pass').then(response => response.json()).then(data => console.log(data));

Custom Headers

This feature shows how to add custom headers to the request. The headers are specified in the options object passed to the fetch method.

const DigestFetch = require('digest-fetch');
const client = new DigestFetch('username', 'password');

const options = {
  headers: {
    'Custom-Header': 'CustomValue'
  }
};

client.fetch('http://httpbin.org/digest-auth/auth/user/pass', options).then(response => response.json()).then(data => console.log(data));

POST Request

This feature demonstrates how to make a POST request with a JSON body. The method and body are specified in the options object passed to the fetch method.

const DigestFetch = require('digest-fetch');
const client = new DigestFetch('username', 'password');

const options = {
  method: 'POST',
  body: JSON.stringify({ key: 'value' }),
  headers: {
    'Content-Type': 'application/json'
  }
};

client.fetch('http://httpbin.org/digest-auth/auth/user/pass', options).then(response => response.json()).then(data => console.log(data));

Other packages similar to digest-fetch

Keywords

FAQs

Package last updated on 12 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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