JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 80
  • Score
    100M100P100Q53198F
  • License ISC

HTTP utils for parsing and formatting

Package Exports

  • @buzuli/http

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@buzuli/http) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

HTTP utilities

Utils for parsing and formatting HTTP data.

status

const {
  codeInfo,
  codes,
  codesSource,
  color
} = require('@buzuli/http').status

status.codeInfo(code)

Code info record based on the supplied status code if found, else undefined.

status.codes()

List of all status codes. The included fields are:

  • code : the numeric code
  • description : short decription of the status code
  • unofficial : true if not this is not an official status code

status.codesSource()

The URL of the source of the full status code listing.

status.color(code)

Color status codes based on value.

console.info(color(code))

url

const {
  coerce,
  color,
  parse
} = require('@buzuli/http').url

url.coerce(uri)

Attempt to parse a string as a URL (more lenient than parse(url)).

const { host, port, ...rest } = coerce(uri)
console.info(`${host}:${port}`)

url.color(uri)

Make a colorful URL applying unique colors to each component.

console.info(color(uri))

url.parse(url)

Parses a URL applying strict requirements (must have both protocol and host).