@kravc/request

1.0.2 • Public • Published

@kravc/request

No dependencies, simple, plain node.js helpers to execute HTTP and JSON requests.

API

Install:

npm i --save @kravc/request

Get started

const { jsonRequest } = require('@kravc/request')

const url = 'https://example.com/source.json'
const { object } = await jsonRequest(console, { url })

object is parsed response JSON body.

const { httpRequest } = require('@kravc/request')

const url = 'https://example.com/source.html'
const { body: buffer } = await jsonRequest(console, { url })

buffer is raw response body.

Readme

Keywords

none

Package Sidebar

Install

npm i @kravc/request

Weekly Downloads

42

Version

1.0.2

License

ISC

Unpacked Size

7.43 kB

Total Files

8

Last publish

Collaborators

  • kravc