The `http-core-constants` library provides a JavaScript/TypeScript port of standard HTTP constants, encompassing headers, status codes, and request methods. These constants are derived directly from the `org.apache.httpcomponents:httpcore` Java library, offering a familiar set of values for developers migrating from Java environments or seeking a standardized set of HTTP definitions. The current stable version is 1.3.0, released in February 2020. The package has seen no updates since then, indicating an abandoned status. A key differentiator is its inclusion of `SC_` prefixed status codes (mirroring Apache's Java library) alongside non-prefixed, more readable alternatives. It primarily serves to eliminate 'magic strings' in HTTP-related code, promoting type safety and maintainability in TypeScript projects by exposing these constants as enums.
npm install http-core-constantsVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing and using various HTTP constants for headers, status codes, and request methods.
Review code that interacts with these constants, especially if performing operations typically applied to plain objects. Ensure correct enum usage in TypeScript, and be aware of potential runtime differences in JavaScript if reflection or dynamic property listing was previously used.
Evaluate alternative HTTP constant libraries such as `http-status-codes` or `@poppanator/http-constants` which are actively maintained and support more recent HTTP specifications and features.
For ESM, ensure named imports are used: `import { HttpHeaders } from 'http-core-constants';`. For CommonJS (if using an older version or transpiled code), ensure destructuring: `const { HttpHeaders } = require('http-core-constants');`.Access constants directly as properties of the imported enum/object, for example: `HttpHeaders.ACCEPT` or `HttpStatus.SC_OK`.
No dependency data recorded yet.