@alwatr/http-primer
TypeScript icon, indicating that this package has built-in type declarations

5.0.0 • Public • Published

HTTP Primer

Essential HTTP utilities for TypeScript, including types for HTTP methods, status codes, and headers.

Installation

npm install @alwatr/http-primer

Usage

HTTP Methods

import {HttpMethods} from '@alwatr/http-primer';

const method = HttpMethods.GET;

HTTP Status Codes

import {HttpStatusCodes} from '@alwatr/http-primer';

const statusCode = HttpStatusCodes.Success_200_OK;

HTTP Headers

import {HttpRequestHeaders, HttpResponseHeaders} from '@alwatr/http-primer';

const requestHeaders: HttpRequestHeaders = {
  accept: 'application/json',
  authorization: 'Bearer my-token',
};

const responseHeaders: HttpResponseHeaders = {
  'content-type': 'application/json',
  'content-length': 1234,
};

MIME Types

import {MimeTypes} from '@alwatr/http-essentials';

const contentType = MimeTypes.JSON; // 'application/json'

Sponsors

The following companies, organizations, and individuals support Nanolib ongoing maintenance and development. Become a Sponsor to get your logo on our README and website.

Exir Studio

Contributing

Contributions are welcome! Please read our contribution guidelines before submitting a pull request.

License

This project is licensed under the AGPL-3.0 License.

Package Sidebar

Install

npm i @alwatr/http-primer

Weekly Downloads

73

Version

5.0.0

License

AGPL-3.0-only

Unpacked Size

169 kB

Total Files

16

Last publish

Collaborators

  • alimd