A light weight nodejs request library with proxy support. Intended to be used by VSCode extensions
Перейти к файлу
Martin Aeschlimann 1676d104a6
prepare 0.7.0 (#20)
2023-01-23 09:24:50 -08:00
.github Remove PR Chat 2022-11-21 15:38:35 -05:00
.vscode adopt publish pipeline (#16) 2022-11-03 16:25:42 +01:00
build adopt publish pipeline (#16) 2022-11-03 16:25:42 +01:00
polyfill support binary, webpack outputs, update dependencies 2021-07-12 16:22:14 +02:00
src Add status 502 (#14) 2023-01-23 18:01:57 +01:00
.gitignore fix gitignore 2016-04-18 15:13:50 +02:00
.npmignore support binary, webpack outputs, update dependencies 2021-07-12 16:22:14 +02:00
CHANGELOG.md support binary, webpack outputs, update dependencies 2021-07-12 16:22:14 +02:00
LICENSE.md fix gitignore 2016-04-18 15:13:50 +02:00
README.md adopt publish pipeline (#16) 2022-11-03 16:25:42 +01:00
SECURITY.md Microsoft mandatory file 2022-09-01 18:07:03 +00:00
api.d.ts prepare 0.7.0 (#20) 2023-01-23 09:24:50 -08:00
package-lock.json prepare 0.7.0 (#20) 2023-01-23 09:24:50 -08:00
package.json prepare 0.7.0 (#20) 2023-01-23 09:24:50 -08:00
webpack.config.js fix source maps 2022-01-07 14:16:59 +01:00

README.md

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