source: imaps-frontend/node_modules/axios/lib/adapters/README.md@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 915 bytes
RevLine 
[d565449]1# axios // adapters
2
3The modules under `adapters/` are modules that handle dispatching a request and settling a returned `Promise` once a response is received.
4
5## Example
6
7```js
8var settle = require('./../core/settle');
9
10module.exports = function myAdapter(config) {
11 // At this point:
12 // - config has been merged with defaults
13 // - request transformers have already run
14 // - request interceptors have already run
15
16 // Make the request using config provided
17 // Upon response settle the Promise
18
19 return new Promise(function(resolve, reject) {
20
21 var response = {
22 data: responseData,
23 status: request.status,
24 statusText: request.statusText,
25 headers: responseHeaders,
26 config: config,
27 request: request
28 };
29
30 settle(resolve, reject, response);
31
32 // From here:
33 // - response transformers will run
34 // - response interceptors will run
35 });
36}
37```
Note: See TracBrowser for help on using the repository browser.