1.0.2 • Published 2 years ago

@kravc/request v1.0.2

Weekly downloads
199
License
ISC
Repository
github
Last release
2 years ago

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