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

@funkybob/request

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@funkybob/request

Promise wrapper for XHR

latest
npmnpm
Version
0.0.9
Version published
Maintainers
1
Created
Source

funky-request

Simple Promise wrapper for XHR

request.request(url, options)

Options:

  • method : GET | POST | ...
  • data : post body
  • form : form element to POST
  • headers: {}
  • query:

If form is provided, it will override data, and a FormData instance will be constructed with it.

If provided, data will be encoded according to the 'Content-Type' header. If it is 'application/json', then data will be JSON encoded. Otherwise, URL encoding will be applied.

request.defaultHeaders = {}

Any values added to this Object will be set as Headers on all requests.

request.prepareHeaders(headers)

A hook to allow a callable to inspect and modify headers before each request.

request.json(url, options)

Automatically decodes successful responses from JSON.

request.rpc(url, method, data)

Sets 'Content-Type' as 'application/json', passes method in a 'X-RPC-Action' header, and JSON decodes the response.

request.RequestError

All errors are raised using this class.

Properties:

  • message: the Method and URL of the request
  • errorType: one of 'error', 'timeout', or 'abort'
  • xhr : the XMLHttpRequest instance

FAQs

Package last updated on 19 Jul 2018

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