1.0.3 • Published 3 years ago

@protagonists/https v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

About

A package that handles GET and POST requests

Now works with version 1.0.8 of @protagonists/coerce


Table of content

The content below does not correspond to the object structure of the objects


How to use?

Description

This package makes it easier to use and handle basic http requests

Import

Terminal

npm install @protagonists/https

Node.js

const { Get, Post } = require("@protagonists/https");

Example

Code:

const { Get, Post } = require("@protagonists/https");

Get({
  host: "csrng.net",
  path: "csrng/csrng.php?min=0&max=100"
}).then(console.log);

Output:

{
  path: '/csrng/csrng.php?min=0&max=100',
  method: 'GET',
  content: [ { status: 'success', min: 0, max: 100, random: 33 } ],
  headers: {
    date: 'Fri, 10 Jun 2022 18:51:27 GMT',
    server: 'Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1k',
    'x-powered-by': 'PHP/7.4.29',
    connection: 'close',
    'transfer-encoding': 'chunked',
    'content-type': 'application/json; charset=utf-8'
  },
  status: { code: 200, message: 'OK' }
}