Security News
New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
@haensl/http
Advanced tools
Changelog
Readme
Simple JSON support module bundling common HTTP headers, status codes and methods.
npm
$ npm install -S @haensl/http
yarn
$ yarn add @haensl/http
Use http status codes, methods and headers in your projects:
ESM, i.e. import
import { statusCodes} from '@haensl/http';
// ...
const response = await fetch(url);
if (response.statusCode < statusCodes.badRequest) {
// do stuff when response status code < 400
}
// ...
CJS, i.e. require
const { headers, methods } = require('@haensl/http');
// ...
const requestOptions = {
headers: {
[headers.contentType]: 'application/json'
},
method: methods.post,
body: JSON.stringify(data)
};
const response = await fetch(url, requestOptions);
// ...
The http
object is a simple JSON object that maps status codes, headers and strings:
{
"statusCodes": {
"ok": 200,
"created": 201,
"accepted": 202,
// ...
},
"headers": {
"accept": "Accept",
"accessControl": {
"allow": {
"origin": "Access-Control-Allow-Origin",
"methods": "Access-Control-Allow-Methods"
// ...
},
// ...
},
"authorization": "Authorization",
"contentType": "Content-Type",
// ...
},
"methods": {
"delete": "delete",
"get": "get",
// ...
}
}
Attention: This JSON object is not exhaustive(, yet)! If you need a status code, header or method added, please create a feature request
FAQs
Simple JSON object of common HTTP headers, status codes and methods.
The npm package @haensl/http receives a total of 8 weekly downloads. As such, @haensl/http popularity was classified as not popular.
We found that @haensl/http demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
Security News
Results from the 2023 State of JavaScript Survey highlight key trends, including Vite's dominance, rising TypeScript adoption, and the enduring popularity of React. Discover more insights on developer preferences and technology usage.
Security News
The US Justice Department has penalized two consulting firms $11.3 million for failing to meet cybersecurity requirements on federally funded projects, emphasizing strict enforcement to protect sensitive government data.