Nonsense Placement Mandatory
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@ianwalter/requester

2.4.2 • Public • Published

@ianwalter/requester

A convenience wrapper around the Node.js http.request API

npm page CI

Installation

yarn add @ianwalter/requester

Usage

Simple example GET request:

const { requester } = require('@ianwalter/requester')
 
const response = await requester.get('http://example.com/api/v1/cats')

Example POST request with custom base options:

const { Requester } = require('@ianwalter/requester')
 
const requester = new Requester({ baseUrl: 'http://example.com/api' })
 
const response = await requester.post('/v1/cats', { name: 'Nibblet' })

Example GET request with a custom request header:

const { requester } = require('@ianwalter/requester')
 
const options = { headers: { authorization: 'Bearer abc123' } }
const response = await requester.get('http://example.com/api/v1/cats', options)

License

Hippocratic License - See LICENSE

 

Created by Ian Walter

Install

npm i @ianwalter/requester

DownloadsWeekly Downloads

569

Version

2.4.2

License

SEE LICENSE IN LICENSE

Unpacked Size

282 kB

Total Files

20

Last publish

Collaborators

  • avatar