http-codex is a lightweight JavaScript/TypeScript library providing constants for standard HTTP status codes and methods, inspired by and closely mirroring the API of Go's `net/http` package. It is currently at version `0.6.6` and appears to be actively maintained, being part of a larger monorepo with recent updates to other packages. The library differentiates itself by its explicit goal to align with Go's `http` package conventions and its focus on bundle size, offering granular imports (e.g., `http-codex/status` or `http-codex/method`) to minimize the loaded code. It includes helper functions like `isNullBodyStatus` for common HTTP response handling patterns. While no strict release cadence is stated, its presence in an active monorepo suggests ongoing development and support.
npm install http-codexVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `http-codex` to construct `Response` objects with proper status codes and texts, use HTTP method constants, and apply the `isNullBodyStatus` helper function.
Ensure you import `httpStatus` from `'http-codex'` if you need the `statusText()` method, or implement status text handling manually if using the smaller `'http-codex/status'` import.
Use `import { httpMethod } from 'http-codex/method'` or `import { httpStatus } from 'http-codex/status'` for targeted imports, then import other helpers like `isNullBodyStatus` from the main package if needed.Refer to the `http-codex` documentation and examples, keeping in mind its Go-inspired design principles, rather than assuming direct parity with other JavaScript HTTP libraries.
Change the import to `import { httpStatus } from 'http-codex'` to access the `statusText()` helper, or manually map status codes to text if `http-codex/status` is specifically required for bundle size.Ensure your project is configured for ES Modules (e.g., `"type": "module"` in `package.json`) and use `import { ... } from 'http-codex'` syntax. If a CommonJS environment is strictly required, consider using a bundler like Webpack or Rollup to transpile.No dependency data recorded yet.