Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

request-light

microsoft3.6mMIT0.8.0TypeScript support: included

Lightweight request library. Promise based, with proxy support.

readme

request-light

npm Package NPM Downloads Build Status License: MIT

A lightweight request library intended to be used by VSCode extensions.

  • NodeJS and browser main entry points
  • proxy support: Use configure or HTTP_PROXY and HTTPS_PROXY env variables to configure the HTTP proxy addresses.
import { xhr, XHRResponse, getErrorStatusDescription } from 'request-light';

const headers = { 'Accept-Encoding': 'gzip, deflate' };
return xhr({ url: url, followRedirects: 5, headers }).then(response => {
    return response.responseText;
}, (error: XHRResponse) => {
    throw new Error(error.responseText || getErrorStatusDescription(error.status) || error.toString());
});

changelog

0.5.0 / 2021-07-12

0.4.0 / 2020-06-17

  • support for browser ('browser' in package.json)

0.3.0 / 2020-02-28

  • Add XHRResponse.headers

0.2.5 / 2019-11-30

  • update https-proxy-agent

0.2.2 / 2017-12-21

  • Error handling for gzip errors
  • Update http-proxy-agent & https-proxy-agent

0.2.1 / 2017-05-16

  • Support for gzip & deflate