Skip to content

axios vs fetch #35

@suukii

Description

@suukii
axios fetch
兼容性 兼容性好,甚至支持 IE11 兼容性没那么好,但是可以通过 whatwg-fetch 这样的 polyfill 库来弥补
超时设置 可以通过 timeout 属性设置超时时间 可以通过 AbortController API 加上定时器来实现
数据格式 会自动把数据转换成 JSON 格式(可以改写) 需要自行转换数据格式
拦截器 提供拦截器拦截 HTTP 请求 可以通过改写原生的 fetch 方法来实现拦截器的效果
进度条 通过 axios progress bar 模块能轻松实现 在响应数据 body 中提供 ReadableStream 实例,可以通过这个实例来实现进度条功能
并行请求 提供 axios.all()axios.spread() 可以借助 Promise.all()

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions