2.0.2 • Published 11 months ago

@blackglory/http-status v2.0.2

Weekly downloads
130
License
MIT
Repository
github
Last release
11 months ago

http-status

A class-based HTTP status library.

Install

npm install --save @blackglory/http-status
# or
yarn add @blackglory/http-status

API

fromCode

function fromCode(code: number): HTTPStatus

When the status code is unknown, it will throw UnkonwnHTTPStatusError.

HTTPStatus

interface HTTPStatus {
  code: number
  message: string
}
CodeHTTPStatus
1xxHTTPInformational
100Continue
101SwitchingProtocol
102Processing
103EarlyHints
2xxHTTPSuccessful
200OK
201Created
202Accepted
203NonAuthoritativeInformation
204NoContent
205ResetContent
206PartialContent
207MultiStatus
208AlreadyReported
226IMUsed
3xxHTTPRedirection
300MultipleChoice
301MovedPermanently
302Found
303SeeOther
304NotModified
307TemporaryRedirect
308PermanentRedirect
4xxHTTPClientError
400BadRequest
401Unauthorized
403Forbidden
404NotFound
405MethodNotAllowed
406NotAcceptable
407ProxyAuthenticationRequired
408RequestTimeout
409Conflict
410Gone
411LengthRequired
412PreconditionFailed
413PayloadTooLarge
414URITooLong
415UnsupportedMediaType
416RangeNotSatisfiable
417ExpectationFailed
421MisdirectedRequest
422UnprocessableEntity
423Locked
424FailedDependency
426UpgradeRequired
428PreconditionRequired
429TooManyRequests
431RequestHeaderFieldsTooLarge
451UnavailableForLegalReasons
5xxHTTPServerError
500InternalServerError
501NotImplemented
502BadGateway
503ServiceUnavailable
504GatewayTimeout
505HTTPVersionNotSupported
506VariantAlsoNegotiates
507InsufficientStorage
508LoopDetected
510NotExtended
511NetworkAuthenticationRequired