New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

request-it-client

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

request-it-client

Yet another client library for working with http/s requests.

latest
Source
npmnpm
Version
1.4.1
Version published
Weekly downloads
1.4K
-19.06%
Maintainers
1
Weekly downloads
 
Created
Source

RequestIt Client

A stupidly simple HTTP client for Node-JS that should just work. Built-in support for cookies, JSON, and may follow up to a max of 20 redirects.

Usage

Install via NPM and require in your project. Then request it and go!

const { RequestIt } = require('request-it-client')

;(async function main () {
  const res = await RequestIt.go('https://reqres.in/api/users/2')

  console.log(res.body.data.first_name) // expected result: Janet
})()

API

class RequestIt

  • new RequestIt(options?: RequestOptions)
  • Instance Members
    • public options: RequestOptions
    • public cookieJar: RequestItCookieJar
    • public go(options?: RequestOptions | string | URL): Promise<IncomingMessage>
    • public get(options?: RequestOptions | string | URL): Promise<IncomingMessage>
    • public patch(options?: RequestOptions | string | URL): Promise<IncomingMessage>
    • public post(options?: RequestOptions | string | URL): Promise<IncomingMessage>
    • public put(options?: RequestOptions | string | URL): Promise<IncomingMessage>
    • public delete(options?: RequestOptions | string | URL): Promise<IncomingMessage>
  • Static Members
    • static go(options?: RequestOptions | string | URL): Promise<IncomingMessage>
    • static get(options?: RequestOptions | string | URL): Promise<IncomingMessage>
    • static patch(options?: RequestOptions | string | URL): Promise<IncomingMessage>
    • static post(options?: RequestOptions | string | URL): Promise<IncomingMessage>
    • static put(options?: RequestOptions | string | URL): Promise<IncomingMessage>
    • static delete(options?: RequestOptions | string | URL): Promise<IncomingMessage>

interface RequestOptions

See NodeJS docs for details.

  • Extended Properties
    • url: string | URL
    • cookieJar?: RequestItCookieJar | CookieJar; Support for Tough Cookie cookie jars.
    • body?: string | Buffer | object | any[]; Raw data to send, an object or array will be JSONified.
    • json?: object | any[]; Support for JSON data.
    • form?: { [key: string]: string | boolean | number } Support for forms data.
    • responseType?: 'json'; Any response will attempt to be parsed regardless of content-type.
    • rejectBadJson?: boolean; Setting to true will throw an error on unparsable JSON.
    • followRedirect?: boolean; Set to true by default, controls whther or not to follow redirects.
    • maxRedirects?: number; Maximum number of redirects to follow with a hard limit of 20, defaults to 3.
    • params?: { [key: string]: string | boolean | number }; URL parameters to pass.

interface IncomingMessage

See NodeJS docs for details.

  • Extended Properties
    • json: () => any
    • body: any
    • cookieJar: RequestItCookieJar
    • rawResponse: Buffer
    • rawBody: Buffer

class RequestItCookieJar extends CookieJar

Extends tough-cookie cookie jar class.

  • new RequestItCookieJar(store?: Store, options?: CookieJar.Options)
  • Instance Members
    • public findCookie(domain: string, path: string, key: string): Promise<Cookie>
  • Static Members
    • static fromCookieJar(cookieJar: CookieJar): RequestItCookieJar

Keywords

http

FAQs

Package last updated on 26 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts