パッケージの詳細

request-light

microsoft3.6mMIT0.8.0

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());
});

更新履歴

0.5.0 / 2021-07-12

  • support binary content (XHRResponse.body)
  • updated to http-proxy-agent@4.0.1, https-proxy-agent@5.0.0
  • webpacked, stripping out debug and dependencies
  • tests

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