
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@stexcore/http-status
Advanced tools
A collection of HTTP status codes for general use in any HTTP framework.
Simplifies the management of HTTP responses and errors with a clean and easy-to-use interface. Fully compatible with TypeScript and any HTTP framework.
Install the package from NPM using the following command:
npm install @stexcore/http-status
import httpStatus from "@stexcore/http-status";
// Create a successful response (200 OK)
const response = httpStatus.ok("Operation successful", { id: 123 });
console.log(response);
// Handle an error (404 Not Found)
const error = httpStatus.notFound("The requested resource was not found");
console.log(error);
// Validate if an object is an HttpError
if (httpStatus.isHttpError(error)) {
console.error("This is an HTTP error!", error.message);
}
| Method | Description |
|---|---|
ok | Creates a 200 OK response. |
created | Creates a 201 Created response. |
accepted | Creates a 202 Accepted response. |
nonAuthoritativeInfo | Creates a 203 Non-Authoritative Information response. |
noContent | Creates a 204 No Content response. |
resetContent | Creates a 205 Reset Content response. |
partialContent | Creates a 206 Partial Content response. |
multiStatus | Creates a 207 Multi-Status response. |
alreadyReported | Creates a 208 Already Reported response. |
imUsed | Creates a 226 IM Used response. |
| Method | Description |
|---|---|
movedPermanently | Creates a 301 Moved Permanently response. |
found | Creates a 302 Found response. |
seeOther | Creates a 303 See Other response. |
notModified | Creates a 304 Not Modified response. |
useProxy | Creates a 305 Use Proxy response. |
temporaryRedirect | Creates a 307 Temporary Redirect response. |
permanentRedirect | Creates a 308 Permanent Redirect response. |
| Method | Description |
|---|---|
badRequest | Creates a 400 Bad Request error. |
unauthorized | Creates a 401 Unauthorized error. |
paymentRequired | Creates a 402 Payment Required error. |
forbidden | Creates a 403 Forbidden error. |
notFound | Creates a 404 Not Found error. |
methodNotAllowed | Creates a 405 Method Not Allowed error. |
notAcceptable | Creates a 406 Not Acceptable error. |
proxyAuthRequired | Creates a 407 Proxy Authentication Required error. |
requestTimeout | Creates a 408 Request Timeout error. |
conflict | Creates a 409 Conflict error. |
gone | Creates a 410 Gone error. |
lengthRequired | Creates a 411 Length Required error. |
preconditionFailed | Creates a 412 Precondition Failed error. |
| Method | Description |
|---|---|
internalServerError | Creates a 500 Internal Server Error. |
notImplemented | Creates a 501 Not Implemented error. |
badGateway | Creates a 502 Bad Gateway error. |
serviceUnavailable | Creates a 503 Service Unavailable error. |
gatewayTimeout | Creates a 504 Gateway Timeout error. |
httpVersionNotSupported | Creates a 505 HTTP Version Not Supported error. |
variantAlsoNegotiates | Creates a 506 Variant Also Negotiates error. |
insufficientStorage | Creates a 507 Insufficient Storage error. |
loopDetected | Creates a 508 Loop Detected error. |
bandwidthLimitExceeded | Creates a 509 Bandwidth Limit Exceeded error. |
notExtended | Creates a 510 Not Extended error. |
networkAuthenticationRequired | Creates a 511 Network Authentication Required error. |
This library is ready to use directly out of the box. TypeScript is optional and supported: declaration files (.d.ts) are included to enable seamless integration for TypeScript projects. If you're using JavaScript, simply install the library and start using it without additional setup.
This package includes key classes for managing HTTP statuses and errors:
Error to represent HTTP errors.Here's a possible use case for integrating this library with Express, a widely used Node.js framework:
import express from "express";
import httpStatus from "@stexcore/http-status";
const app = express();
// A sample route to return a successful response
app.get("/success", (req, res) => {
res.json(httpStatus.ok("The operation was successful!", { data: "Example data" }));
});
// A route to simulate a server error
app.get("/error", (req, res) => {
res.status(500).json(httpStatus.internalServerError("An unexpected error occurred.", { traceId: "123-abc" }));
});
// Start the server
const PORT = 3000;
app.listen(PORT, () => {
console.log(`Server is running on http://localhost:\${PORT}`);
});
In this example:
/success route demonstrates a typical 200 OK response with additional data./error route showcases how you can return a structured 500 Internal Server Error.If you'd like to contribute or report issues, visit our GitHub repository:
https://github.com/stexcore/http-status
This project is licensed under the MIT license. See the LICENSE file for more details.
FAQs
Collection of HTTP status for general use in any HTTP framework
The npm package @stexcore/http-status receives a total of 0 weekly downloads. As such, @stexcore/http-status popularity was classified as not popular.
We found that @stexcore/http-status demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.