npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

known-http-header-db

v1.0.6

Published

Known HTTP Header Database

Downloads

21

Readme

HTTP Header Database

NPM

NPM Version license Donate to this project using Paypal

This is a large database of known HTTP Headers and information about them. It consists of a single, public JSON file and does not include any logic, allowing it to remain as un-opinionated as possible with an API. It aggregates data from the following sources:

  • https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
  • https://www.iana.org/assignments/http-fields/http-fields.xhtml
  • https://en.wikipedia.org/wiki/List_of_HTTP_header_fields

Installation

npm i --save known-http-header-db

Database Download

If you want download the database and use it directly in the browser, you can just grab the JSON file using jsDelivr. It is recommended to replace main with a release tag as the JSON format may change in the future.

https://cdn.jsdelivr.net/gh/pichillilorenzo/known-http-header-db@main/dist/db.json

Usage

import db from 'known-http-header-db';
// .. or
const db = require('known-http-header-db').default;

const contentTypeInfo = db['content-type']; // An instance of HTTPHeader
console.log(contentTypeInfo.name); // Content-Type

Access HTTP Header info using the header name in lower case as key.

Contributing

The primary way to contribute to this database is by updating the data in one of the upstream sources. Check the scripts/src/mdn-scraper.ts to check the MDN scraper implementation.

Direct Inclusion

If that is not possible / feasible, they can be added directly here as a "custom" header.

To edit the database, only make PRs against scripts/src/custom-headers.json.

The scripts/src/custom-headers.json file is a JSON object of type HTTPHeaderDb, where each key is the header name in lower case and the value is an Object of type HTTPHeader.

To update the build, run npm run build:all.

HTTPHeaderDb Data Structure Example

{
  "accept": {...},
  "content-type": {
    "name": "Content-Type",
    "type": [
      "representation"
    ],
    "description": "The Content-Type representation header is used to indicate the original media type of the resource (prior to any content encoding applied for sending). In responses, a Content-Type header provides the client with the actual content type of the returned content. This header's value may be ignored, for example when browsers perform MIME sniffing; set the X-Content-Type-Options header value to nosniff to prevent this behavior. In requests, (such as POST or PUT), the client tells the server what type of data is actually sent.",
    "syntax": "Content-Type: text/html; charset=UTF-8\nContent-Type: multipart/form-data; boundary=something",
    "link": "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type",
    "forbiddenHeaderName": false,
    "corsSafeListedRequestHeader": false,
    "corsSafeListedResponseHeader": true,
    "examples": [],
    "directives": [
      {
        "name": "media-type",
        "description": "The MIME type of the resource or the data."
      },
      {
        "name": "charset",
        "description": "The character encoding standard."
      },
      {
        "name": "boundary",
        "description": "For multipart entities the boundary directive is required. The directive consists of 1 to 70 characters from a set of characters (and not ending with white space) known to be very robust through email gateways. It is used to encapsulate the boundaries of the multiple parts of the message. Often, the header boundary is prepended with two dashes and the final boundary has two dashes appended at the end."
      }
    ],
    "specifications": [
      {
        "name": "HTTP Semantics # status.206",
        "link": "https://httpwg.org/specs/rfc9110.html#status.206"
      },
      {
        "name": "HTTP Semantics # field.content-type",
        "link": "https://httpwg.org/specs/rfc9110.html#field.content-type"
      }
    ],
    "browserCompatibility": [
      {
        "feature": "Content-Type",
        "browsers": [
          {
            "name": "Chrome",
            "supported": true,
            "version": "Yes"
          },
          {
            "name": "Edge",
            "supported": true,
            "version": "12"
          },
          {
            "name": "Firefox",
            "supported": true,
            "version": "Yes"
          },
          {
            "name": "Opera",
            "supported": true,
            "version": "Yes"
          },
          {
            "name": "Safari",
            "supported": true,
            "version": "Yes"
          },
          {
            "name": "Chrome Android",
            "supported": true,
            "version": "Yes"
          },
          {
            "name": "Firefox for Android",
            "supported": true,
            "version": "Yes"
          },
          {
            "name": "Opera Android",
            "supported": true,
            "version": "Yes"
          },
          {
            "name": "Safari on iOS",
            "supported": true,
            "version": "Yes"
          },
          {
            "name": "Samsung Internet",
            "supported": true,
            "version": "Yes"
          },
          {
            "name": "WebView Android",
            "supported": true,
            "version": "Yes"
          }
        ]
      }
    ]
  },
  "content-length": {...},
  ...
}

Check HTTPHeaderDb for more details.

License

Released under the ISC license.

This project is strongly inspired by the mime-db.