1.0.0 • Published 3 years ago

@protagonists/request v1.0.0

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.1.2 of @protagonists/coerce


Table of content

The content may not correspond to the object structure of the objects


How to use?

Description

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

Import

Terminal

npm install @protagonists/request

Node.js

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

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' }
}