🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

@alessiofrittoli/http-server-status

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alessiofrittoli/http-server-status

HTTP Server Status TypeScript enumerators and default messages

latest
Source
npmnpm
Version
1.3.0
Version published
Weekly downloads
17
30.77%
Maintainers
1
Weekly downloads
 
Created
Source

HTTP Server Status 📣

NPM Latest Version Coverage Status Socket Status NPM Monthly Downloads Dependencies

GitHub Sponsor

HTTP Server Status TypeScript enumerators and default messages

This module provides a comprehensive representation of HTTP status codes categorized into different response types, as defined in the HTTP standard. Each category is implemented as an enumeration (enum) for type-safe usage in TypeScript. A unified ResponseStatus object is also exported, allowing easy access to all status codes.

Table of Contents

Getting started

Run the following command to start using http-server-status in your projects:

npm i @alessiofrittoli/http-server-status

or using pnpm

pnpm i @alessiofrittoli/http-server-status

API Reference

InformationResponse Enum

Represents HTTP 1xx status codes, indicating informational responses.

Constants Overview
ConstantValueDescription
Continue100The client should continue the request or ignore the response if the request is already finished.
SwitchingProtocols101The server is switching to the Upgraded protocol.
Processing102Processing the request, no response is available yet.
EarlyHints103Start preloading resources while the server prepares a response.

SuccessResponse Enum

Represents HTTP 2xx status codes, indicating successful requests.

Constants Overview
ConstantValueDescription
Ok200Ok
Created201The request succeeded, and a new resource was created as a result.
Accepted202The request has been received but not yet acted upon.
NonAuthoritative203The returned metadata is not exactly the same as is available from the origin server, but is collected from a local or a third-party copy.
NoContent204There is no content to send for this request, but the headers may be useful.
ResetContent205Reset the document which sent this request.
PartialsContent206The Range header is sent from the client to request only part of a resource.
MultiStatus207Conveys information about multiple resources, for situations where multiple status codes might be appropriate.
AlreadyReported208Avoid repeatedly enumerating the internal members of multiple bindings to the same collection.
ImUsed226The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.

RedirectionResponse Enum

Represents HTTP 3xx status codes, indicating redirection.

Constants Overview
ConstantValueDescription
MultipleChoices300The request has more than one possible response. The user agent or user should choose one of them.
MovedPermanently301The URL of the requested resource has been changed permanently. The new URL is given in the response.
Found302The URI of requested resource has been changed temporarily. Further changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests.
SeeOther303Direct the client to get the requested resource at another URI with a GET request.
NotModified304The response has not been modified, so the client can continue to use the same cached version of the response.
TemporaryRedirect307Get the requested resource at another URI with same method that was used in the prior request.
PermanentRedirect308The resource is now permanently located at another URI, specified by the Location: HTTP Response header.

ClientErrorResponse Enum

Represents HTTP 4xx status codes, indicating client errors.

Constants Overview
ConstantValueDescription
BadRequest400Cannot process the request due to something that is perceived to be a client error.
Unauthorized401You must be authenticated to get the requested response.
PaymentRequired402Payment required to access this content.
Forbidden403You do not have access rights to the content.
NotFound404The server can not find the requested resource.
MethodNotAllowed405HTTP method not supported by the target resource.
NotAcceptable406Cannot find, after performing server-driven content negotiation, any content that conforms to the criteria given by the user agent.
ProxyAuthenticationRequired407Authentication is needed to be done by a proxy.
RequestTimeout408The server would like to shut down this unused connection.
Conflict409The request conflicts with the current state of the server.
Gone410The requested content has been permanently deleted from server
LengthRequired411Server rejected the request because the Content-Length header field is not defined and the server requires it.
PreconditionFailed412The client has indicated preconditions in its headers which the server does not meet.
PayloadTooLarge413Request entity is larger than limits defined by server. The server might close the connection or return an Retry-After header field.
UriTooLong414The URI requested by the client is longer than the server is willing to interpret.
UnsupportedMediaType415The media format of the requested data is not supported by the server. Rejecting the request.
RangeNotSatisfiable416The range specified by the Range header field in the request cannot be fulfilled.
ExpectationFailed417The expectation indicated by the Expect request header field cannot be met by the server.
ImTeapot418The server refuses the attempt to brew coffee with a teapot.
MisdirectedRequest421The request was directed at a server that is not able to produce a response.
UnprocessableEntity422The request was well-formed but was unable to be followed due to semantic errors.
Locked423The resource that is being accessed is locked.
FailedDependency424The request failed due to failure of a previous request.
TooEarly425The server is unwilling to risk processing a request that might be replayed.
UpgradeRequired426The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol.
PreconditionRequired428The origin server requires the request to be conditional.
TooManyRequests429Too many requests in a given amount of time.
RequestHeaderFieldsTooLarge431The server is unwilling to process the request because its header fields are too large.
UnavailableForLegalReasons451The user agent requested a resource that cannot legally be provided.

ServerErrorResponse Enum

Represents HTTP 5xx status codes, indicating server errors.

Constants Overview
ConstantValueDescription
InternalServerError500There has been an error on the server.
NotImplemented501The request method is not supported by the server and cannot be handled.
BadGateway502The server, while working as a gateway to get a response needed to handle the request, got an invalid response.
ServiceUnavailable503The server is not ready to handle the request.
GatewayTimeout504The server is acting as a gateway and cannot get a response in time.
HTTPVersionNotSupported505The HTTP version used in the request is not supported by the server.
VariantAlsoNegotiates506The chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process.
InsufficientStorage507The method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request.
LoopDetected508Infinite loop detected while processing the request.
NotExtended510Further extensions to the request are required for the server to fulfill it.
NetworkAuthenticationRequired511The client needs to authenticate to gain network access.

Development

Install depenendencies

npm install

or using pnpm

pnpm i

Build the source code

Run the following command to test and build code for distribution.

pnpm build

ESLint

warnings / errors check.

pnpm lint

Jest

Run all the defined test suites by running the following:

# Run tests and watch file changes.
pnpm test:watch

# Run tests in a CI environment.
pnpm test:ci

Run tests with coverage.

An HTTP server is then started to serve coverage files from ./coverage folder.

⚠️ You may see a blank page the first time you run this command. Simply refresh the browser to see the updates.

test:coverage:serve

Contributing

Contributions are truly welcome!

Please refer to the Contributing Doc for more information on how to start contributing to this project.

Help keep this project up to date with GitHub Sponsor.

GitHub Sponsor

Security

If you believe you have found a security vulnerability, we encourage you to responsibly disclose this and NOT open a public issue. We will investigate all legitimate reports. Email security@alessiofrittoli.it to disclose any security vulnerabilities.

Made with ☕

avatar
Alessio Frittoli
https://alessiofrittoli.it | info@alessiofrittoli.it

Keywords

http-server-status

FAQs

Package last updated on 02 May 2025

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