request-light
v0.8.0
Published
Lightweight request library. Promise based, with proxy support.
Downloads
3,568,460
Keywords
Readme
request-light
A lightweight request library intended to be used by VSCode extensions.
- NodeJS and browser main entry points
- proxy support: Use
configure
orHTTP_PROXY
andHTTPS_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());
});