@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.