request, but much smaller - and with less options. Uses
node-fetch under the hood.
Pop it in where you would use
request. Improves load and parse time of modules.
const request = teenyRequest;;
For TypeScript, you can use
;; // Only for type declarationsrequest,;
Options are limited to the following
- method, default GET
- timeout in ms
The callback argument gets 3 arguments:
- An error when applicable (usually from http.ClientRequest object)
- An response object with statusCode, a statusMessage, and a body
- The third is the response body (JSON object)
Set default options for every
Proxy environment variables
If environment variables
HTTPS_PROXY are set, they are respected.
NO_PROXY is currently not implemented.
Building with Webpack 4+
Since 4.0.0, Webpack uses
.mjs files which handles ESM more strictly compared to
Can't import the named export 'PassThrough' from non EcmaScript module, please add the following to your Webpack config:
request has a ton of options and features and is accordingly large. Requiering a module incurs load and parse time. For
request, that is around 600ms.
teeny-request doesn't have any of the bells and whistles that
request has, but is so much faster to load. If startup time is an issue and you don't need much beyong a basic GET and POST, you can use
Special thanks to billyjacobson for suggesting the name. Please report all bugs to them. Just kidding. Please open issues.