Proquest (Promise Request)
Ultra light wrapper around XHR requests that returns Promises for composition.
Installation
Designed for usage with CJS, namely via browserify.
npm install proquest --save-dev
Then simply require it:
var Request = Request;
Usage
Proquest takes many of its design cues from superagent, but in an extremely paired back way.
// Composing a request var Request = Request;var request = 'POST' 'https://example.com/things'; request ;
Often in the context of an application each request will share most headers.
This can be achieved easily with a partial
request:
// Compose a request using method, url, data, or header options.var partial = Request; // Store the partial request for use throughout the application.MyApprequest = partial; // Elsewhere, use the request by invoking and completing it.var request = ;
Inject a default error handler into all requests:
Request;
Notes
Proquest expects a modern XHR api underneath. That means IE8 and below isn't going to work.