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 update dependencies and prepare 0.8.0 (#32) 2024-07-01 15:16:38 -07:00
.vscode update dependencies and prepare 0.8.0 (#32) 2024-07-01 15:16:38 -07:00
build chore: bump to Node 18 (#28) 2023-11-09 19:14:14 +01:00
polyfill support binary, webpack outputs, update dependencies 2021-07-12 16:22:14 +02:00
src update dependencies and prepare 0.8.0 (#32) 2024-07-01 15:16:38 -07:00
.gitignore chore: add suppression file (#31) 2024-06-24 11:42:22 -07: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
gdnsuppress.gdnsuppress chore: add suppression file (#31) 2024-06-24 11:42:22 -07:00
package-lock.json update dependencies and prepare 0.8.0 (#32) 2024-07-01 15:16:38 -07:00
package.json Add package exports (#25) 2024-07-02 07:50:11 +00: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());
});