cathay-fetch

2.3.5 • Public • Published

About

  • 封装了isomorphic
  • 封装统一response为json
  • 默认status处理(目前主要PC)
    • 400 通用错误交互处理
    • 306 RESTFUL URL REDIRECT

使用方法(与原生fetch保持一致)

fetch(url, options)

example

 
import fetch from '@cathay/fetch';
 
fetch('./test.json', {
    body: {
        "a1": 1,
        "a2": 2
    }
}).then((resultJson)=>{
    console.log(daresultJsonta);
})

options默认值

另外, options设置了默认值, 默认值为

{
    credentials: 'include',
    headers: {
        'Content-Type': 'application/json'
    }
}

History

2.3.5

  • 修改DingTalkAppId
  • 修改DingTalk回调地址

2.3.1

  • 更新库
  • 添加虎符集成

2.2.8

  • 错误文案提醒更改
  • eslint format

2.2.7

  • update font-size to 14px

2.2.6

  • 文案优化
  • 样式优化

2.2.5

  • 更改链接地址

2.2.4

  • memory only /api url
  • 增减黑名单域名 ,memory不记录,目前有bbs

2.2.1

  • username支持中文编码

2.2.0

  • 去掉username校验,以便可以花名登陆

2.1.20

  • bugfix of PUT content-type

2.1.17

  • inverse this.fetchCanBeRecover about times calc

2.1.16

  • bugfix of this.fetchCanBeRecover

2.1.14

  • status: 399 -> 306
  • 恢复 README

2.0.0

  • 默认 POST -> GET

0.5.0

  • 修改nginx默认不支持下划线变量的问题, 参见:http://stackoverflow.com/questions/22856136/why-underscores-are-forbidden-in-http-header-names

0.4.0

  • 除404外,增加400, 500错误,直接Promise.reject

0.3.0

  • options中扩展jsonPrefixBody属性, 废弃isJava第三参数

0.2.0

  • bugfix
  • 工程化更改, 发布前需要进行build

0.1.0

初始版本,核心功能

Readme

Keywords

none

Package Sidebar

Install

npm i cathay-fetch

Weekly Downloads

3

Version

2.3.5

License

ISC

Unpacked Size

83 kB

Total Files

35

Last publish

Collaborators

  • cathay