1.0.8 • Published 5 months ago

nitro-http-client v1.0.8

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
5 months ago

nitro-http-client

npm release Support me on Patreon

A HTTP client module I made because I can't deal with other modules
It does not support/handle compression, I'll eventually implement it according to my needs

Installation

  • NPM: npm install nitro-http-client
  • Yarn: yarn add nitro-http-client

Usage

JavaScript

Create the client

const { NitroHttpClient } = require('nitro-http-client');
const httpClient = new NitroHttpClient();

TypeScript

Create the client

import { NitroHttpClient } from 'nitro-http-client';
const httpClient = new NitroHttpClient();

Examples

Example with default values, no body, GET method, no extra headers

const response = await httpClient.request('https://example.com');
console.log(response.statusCode);

.then example since it returns a Promise

httpClient.request('https://example.com').then(response => {
  console.log(response.body);
});

Example with custom values

const response = await httpClient.request('https://example.com', {
  method: 'POST',
  headers: {
    Authentication: '123',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ test: 123 })
});
console.log(response.headers);
1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

8 months ago

1.0.5

1 year ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago