A light weight nodejs request library with proxy support. Intended to be used by VSCode extensions
Перейти к файлу
Remco Haszing 386b679759
Add package exports (#25)
This ensures the browser API is used for the `browser` condition, and
the Node.js API for everything else.
2024-07-02 07:50:11 +00:00
.github
.vscode
build
polyfill
src
.gitignore
.npmignore
CHANGELOG.md
LICENSE.md
README.md
SECURITY.md
api.d.ts
gdnsuppress.gdnsuppress
package-lock.json
package.json
webpack.config.js

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