GitHub - microsoft/node-request-light: A light weight nodejs request library with proxy support. Intended to be used by VSCode extensions (original) (raw)

request-light

npm Package NPM Downloads Build Status License: MIT

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

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