Socket
Socket
Sign inDemoInstall

http-sts

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    http-sts

HTTP status codes


Version published
Maintainers
1
Install size
55.4 kB
Created

Readme

Source

http-sts

HTTP status codes mapper from MDN HTTP status codes

package health

Build Status GitHub version npm version

NPM

Motivation

This is a mapping based on the actual code number, so for 200 we have CODE_200. The codes contain the number, the name, and also the description gathered from MDN's https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

Install

Just run:

npm i http-sts

Description

The codes follow this format:

export declare type HTTPStatusCodeType = {
  code: number;
  name: string;
  description?: string;
};

Usage

import { HTTPStatusCodes } from "http-sts";

// do stuff with the codes
console.log(HTTPStatusCodes.CODE_200);

// which outputs something like
/*
HTTPStatusCode {
  code: 200,
  name: 'OK',
  description: 'The request has succeeded. The meaning of the success depends on the HTTP method:\n' +
    'GET: The resource has been fetched and is transmitted in the message body.\n' +
    'HEAD: The entity headers are in the message body.\n' +
    'PUT or POST: The resource describing the result of the action is transmitted in the message body.\n' +
    'TRACE: The message body contains the request message as received by the server'
}
*/

Supported codes

Status CodePathNameMDN Link
100CODE_100Continuehttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/100
101CODE_101Switching protocolhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/101
102CODE_102Processinghttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/102
103CODE_103Early hintshttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/103
200CODE_200OKhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200
201CODE_201Createdhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201
202CODE_202Acceptedhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202
203CODE_203Non-Authoritative Informationhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/203
204CODE_204No Contenthttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204
205CODE_205Reset Contenthttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/205
206CODE_206Partial Contenthttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206
207CODE_207Multi-Statushttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/207
208CODE_208Already Reportedhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/208
226CODE_226IM Usedhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/226
300CODE_300Multiple Choicehttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/300
301CODE_301Moved Permanentlyhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301
302CODE_302Foundhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302
303CODE_303See Otherhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303
304CODE_304Not Modifiedhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304
305CODE_305Use Proxyhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/305
306CODE_306unusedhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/306
307CODE_307Temporary Redirecthttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307
308CODE_308Permanent Redirecthttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308
400CODE_400Bad Requesthttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400
401CODE_401Unauthorizedhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
402CODE_402Payment Requiredhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/402
403CODE_403Forbiddenhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403
404CODE_404Not Foundhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
405CODE_405Method Not Allowedhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
406CODE_406Not Acceptablehttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/406
407CODE_407Proxy Authentication Requiredhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/407
408CODE_408Request Timeouthttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408
409CODE_409Conflicthttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409
410CODE_410Gonehttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/410
411CODE_411Length Requiredhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/411
412CODE_412Precondition Failedhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412
413CODE_413Payload Too Largehttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/413
414CODE_414URI Too Longhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/414
415CODE_415Unsupported Media Typehttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/415
416CODE_416Range Not Satisfiablehttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416
417CODE_417Expectation Failedhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/417
418CODE_418I'm a teapothttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/418
421CODE_421Misdirected Requesthttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/421
422CODE_422Unprocessable Entityhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422
423CODE_423Lockedhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/423
424CODE_424Failed Dependencyhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/424
425CODE_425Too Earlyhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/425
426CODE_426Upgrade Requiredhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/426
428CODE_428Precondition Requiredhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/428
429CODE_429Too Many Requestshttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429
431CODE_431Request Header Fields Too Largehttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/431
451CODE_451Unavailable For Legal Reasonshttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/451
500CODE_500Internal Server Errorhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500
501CODE_501Not Implementedhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/501
502CODE_502Bad Gatewayhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502
503CODE_503Service Unavailablehttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503
504CODE_504Gateway Timeouthttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504
505CODE_505HTTP Version Not Supportedhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/505
506CODE_506Variant Also Negotiateshttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/506
507CODE_507Insufficient Storagehttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/507
508CODE_508Loop Detectedhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/508
510CODE_510Not Extendedhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/510
511CODE_511Network Authentication Requiredhttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/511

Keywords

FAQs

Last updated on 11 Sep 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc