http-sts (HTTP Status Codes) is a JavaScript/TypeScript library designed to provide a comprehensive and structured collection of HTTP status codes. It maps each code to an object containing its numeric value, a human-readable name, and a detailed description directly sourced from MDN Web Docs. Currently at version 1.1.4, the package offers a stable and reliable way to access information for a wide range of HTTP responses, from informational (1xx) to server error (5xx) codes. Unlike simpler enumeration libraries, http-sts provides rich, descriptive content for each status code, making it suitable for applications that require more than just the code number or a basic name. Its release cadence is generally stable, with updates primarily reflecting changes or additions to HTTP status codes on MDN. Key differentiators include the depth of information provided and its direct lineage from an authoritative source like MDN, ensuring accuracy and detail.
npm install http-stsVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and access individual HTTP status code objects, including their code, name, and description. It also shows how to iterate through all available codes and conceptual usage in a web server context.
Always access status codes using their `CODE_XXX` property names (e.g., `HTTPStatusCodes.CODE_404`). If you need to map a number to a code, you'll need to create a helper function or map over the `HTTPStatusCodes` object.
Use the `code` and `name` properties for programmatic logic. Treat `description` as display-only content. Periodically update the package to get the latest MDN descriptions.
Ensure you are using a valid `CODE_XXX` property name from the `HTTPStatusCodes` object. Verify the status code actually exists in the library. If using a numeric value, ensure it's correctly mapped to its `CODE_XXX` string representation.
Switch to ESM `import` statements: `import { HTTPStatusCodes } from 'http-sts';`. Ensure your project is configured for ESM if you intend to use it, or stick to CommonJS `require` if your environment explicitly supports it.No dependency data recorded yet.