Metal.js utility to perform Ajax requests
npm install metal-ajax

Low-level Metal.js utility to perform Ajax requests. If you're looking for
something higher level, take a look
at fetch.
``javascript
import Ajax from 'metal-ajax';
Ajax.request('/url', 'get')
.then(xhrResponse => {
// Handle response
});
`
`javascript`
Ajax.request('/url', 'post', 'requestBody')
.then(xhrResponse => {
// Handle response
});
Custom request headers and params can bet set
using a MultiMap from metal-structs.
`javascript
import {MultiMap} from 'metal-structs';
const headers = new MultiMap();
const params = new MultiMap();
headers.add('content-type', 'application/json');
params.add('foo', 'bar');
Ajax.request('/url', 'get', null, headers, params)
.then(function(xhrResponse) {
// Handle response
});
`
`javascript`
Ajax.request('/url', 'get')
.then(xhrResponse => {
// Handle response
})
.catch(error => {
// Handle error
});
In order for the progress listener to work, the response _must_ have
the Content-Length response
header set.
`javascript`
Ajax.request('/url', 'get')
.progress(progress => {
// Fires with a value between 0 and 1 representing the percent
})
.then(xhrResponse => {
// Handle response
})
1. Install a recent release of NodeJS if you
don't have it yet.
2. Install local dependencies:
``
npm install
3. Run the tests:
```
npm test
Check out the contributing guidelines for more information.