ThePywon / request

A simple package to handle http requests so you don't have to

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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






This is the bottom, there is nothing more.
Go back up?

About

A simple package to handle http requests so you don't have to


Languages

Language:JavaScript 100.0%