Skip to content

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

Notifications You must be signed in to change notification settings

ThePywon/request

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published