基于 window.fetch 的请求工具
Methods
-
FetchRequest._fetch(url, body, options){Promise.<(Response|Error)>}
service/FetchRequest.js, line 51 -
实际的请求发送方法
Name Type Description urlString 请求基地址
bodyString | Object 请求体
optionsObject 额外参数
Name Type Default Description headersObject 可选 请求头信息
withCredentialsBoolean true 可选 是否携带cookies
requestTimeoutNumber 45000 可选 请求超时时间,默认45000ms,即45s
methodFetchMethod FetchMethod.get 可选 请求类型
Returns:
Type Description Promise.<(Response|Error)> 请求结果 -
FetchRequest.commit(method, url, body, options){Promise.<(Response|Error)>}
service/FetchRequest.js, line 23 -
根据method调用不同类型的请求
Name Type Description methodFetchMethod 请求类型,默认FetchMethod.get
urlString 请求地址
bodyString | Object 要放入 body 里的内容
optionsObject 额外参数
Name Type Default Description headersObject 可选 请求头信息
requestTimeoutNumber 45000 可选 请求超时时间,默认45000ms,即45s
Returns:
Type Description Promise.<(Response|Error)> 请求结果