mirror of
https://github.com/axios/axios.git
synced 2026-04-11 02:11:50 +08:00
Adding README to modules
This commit is contained in:
parent
4d1269cb4a
commit
eea790b8de
38
lib/adapters/README.md
Normal file
38
lib/adapters/README.md
Normal file
@ -0,0 +1,38 @@
|
||||
# axios // adapters
|
||||
|
||||
The modules under `adapters/` are modules that handle dispatching a request and settling a `Promise` once a response is received.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var settle = require('../helpers/settle');
|
||||
var transformData = require('./../helpers/transformData');
|
||||
|
||||
module.exports myAdapter(resolve, reject, config) {
|
||||
// At this point:
|
||||
// - config has been merged with defaults
|
||||
// - request transformers have already run
|
||||
// - request interceptors have already run
|
||||
|
||||
// Make the request using config provided/
|
||||
// Upon response settle the Promise
|
||||
|
||||
var response = {
|
||||
data: transformData(
|
||||
responseData,
|
||||
responseHeaders,
|
||||
config.transformResponse
|
||||
),
|
||||
status: request.status,
|
||||
statusText: request.statusText,
|
||||
headers: responseHeaders,
|
||||
config: config,
|
||||
request: request
|
||||
};
|
||||
|
||||
settle(resolve, reject, response);
|
||||
|
||||
// From here:
|
||||
// - response interceptors will run
|
||||
}
|
||||
```
|
||||
7
lib/core/README.md
Normal file
7
lib/core/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# axios // core
|
||||
|
||||
The modules found in `core/` should be modules that are specific to the domain logic of axios. These modules would most likely not make sense to be consumed outside of the axios module, as their logic is too specific. Some examples of core modules are:
|
||||
|
||||
- Dispatching requests
|
||||
- Managing interceptors
|
||||
- Handling config
|
||||
7
lib/helpers/README.md
Normal file
7
lib/helpers/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# axios // helpers
|
||||
|
||||
The modules found in `helpers/` should be generic modules that are _not_ specific to the domain logic of axios. These modules could theoretically be published to npm on their own and consumed by other modules or apps. Some examples of generic modules are things like:
|
||||
|
||||
- Browser polyfills
|
||||
- Managing cookies
|
||||
- Parsing HTTP headers
|
||||
Loading…
Reference in New Issue
Block a user