Cuddle
Cuddle is a minimal, chainable, retryable and "readability first" node http client. It's built to use for calling third-party APIs. Just what you need.
npm i cuddle@latest -S
Use Cases
Important notes
- Status code < 200 or >= 300 will be classifed as an error.
- Request will not fire unless
.then
or.end
is called
Simple
const cudl = ; cudlpost ;
Promise:
const cudl = ; cudlpost ;
Using with generators:
const cudl = ;const co = ; { let user = cudlget ; console;} ;
Throttling requests
// will only let 50 concurrent requestscudl;
Easy scoping through args:
const cudl = ; { const users = id: 1 name: 'jeff' id: 2 name: 'jenny' id: 3 name: 'julius' ; users;} { if err // cuddle will return a different error after reaching maximum retries if errcode >= 500 return request; console; return; usermore_info = result; // ...} ;