一张图看懂 axios
2019-08-08 17:49:35 0 举报
一张图看懂 Axios 源码
作者其他创作
大纲/内容
HEAD
respoonse interceptor 1
auth
config
settle
data transform
request.onreadystatechangerequest.onabortrequest.onerrorrequest.ontimeout request.addEventListener('progress')
dispatchRequest
response
XHR
request.send
create transport request
buildURL
axios(扩展静态方法)
axios.create = function () {}
new Axios(instanceConfig)
request.Authorization
request interceptor 1
PATCH
axios.Cancelaxios.CancelTokenaxios.isCancel
Node
POST
request interceptor 2
PUT
adapter 请求适配器
GET
options
req.on('data')req.on('error')req.on('end')
构建 Promise Chain
axios.all = function () {}
DELETE
new XMLHttpRequest
request.open
axios.spread = function () {}
request interceptor 3
Axios.prototype.request
Axios
proxy
handle response
respoonse interceptor 2
is Form Data
OPTION
添加默认值Axios.defaults = instanceConfig
req.send
const axios = createInstance()
收藏
0 条评论
下一页