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

headers-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

headers-polyfill

A native "Headers" class polyfill.

  • 3.2.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5M
decreased by-54.65%
Maintainers
1
Weekly downloads
 
Created

What is headers-polyfill?

The headers-polyfill npm package provides a way to manipulate HTTP headers, allowing you to create, read, and modify HTTP headers in a standardized manner. It is designed to mimic the Headers interface provided by the Fetch API, making it useful for environments where this API is not available or for projects that aim for consistency across different environments.

What are headers-polyfill's main functionalities?

Creating and appending headers

This feature allows you to create a new Headers object and append new headers to it. It's useful for setting up the headers required for an HTTP request.

{"const headers = new Headers();\nheaders.append('Content-Type', 'application/json');\nheaders.append('Authorization', 'Bearer your_token_here');"}

Reading header values

This feature enables you to read the value of a specific header by name. It's useful for inspecting headers received in an HTTP response.

{"const contentType = headers.get('Content-Type');"}

Checking for a header's existence

This feature allows you to check if a certain header exists within the Headers object. It's useful for conditional logic based on the presence of specific headers.

{"const hasContentType = headers.has('Content-Type');"}

Deleting a header

This feature enables you to remove a header from the Headers object. It's useful for modifying headers before sending an HTTP request or after processing an HTTP response.

{"headers.delete('Authorization');"}

Other packages similar to headers-polyfill

FAQs

Package last updated on 07 Sep 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