umi-request icon indicating copy to clipboard operation
umi-request copied to clipboard

A request tool based on fetch.

Results 100 umi-request issues
Sort by recently updated
recently updated
newest added

will into the exception; fetch should be not exception;

umi-request (^1.4.0) -> isomorphic-fetch (^2.2.1) -> node-fetch (1.7.6) #294

request.interceptors.response拦截器 在next。js中, 如果接口返回的数据过大,request.interceptors.response 会卡死,页面也卡死。 吧拦截器删除就没事了。 我在想是不是request.interceptors.response里面做什么东西 导致的! 客户端不存在这个情况

如图,需要这些字段来完成全局错误提示 ![image](https://user-images.githubusercontent.com/26673917/126041119-390efbd6-ffbb-4928-bb21-c2471500897b.png) umi-request 配置如下 const errorHandler = (error: ResponseError) => { const { response } = error; debugger if (response && response.status) { const errorText = codeMessage[response.status] || response.statusText; const...

![image](https://user-images.githubusercontent.com/88997271/179439775-6426275c-40ee-4bbc-bc1b-26eba5dc9df1.png) ![image](https://user-images.githubusercontent.com/88997271/179439755-e5c03ec8-8dcd-4b74-b25e-0671fd3bed9a.png) 代码有报错

× 断网的时候就会报这样的错误 ←→1 of 7 errors on the page Unhandled Rejection (TypeError): Failed to fetch ▶ 12 stack frames were collapsed. _callee$ ./src/.umi/plugin-request/request.ts:217 214 | // 中间件统一错误处理 215 | //...

你好,我想问一下到底会在什么情况下代码才会进入errorHandler执行? 我开始理解的是httpcode 不等于200的情况下会进入errorHandler,但是经过我实验,在断网的情况下,发起网络请求,httpcode 返回的是504的情况下,依然进入了响应拦截器里面,并没有进入errorHandler,而且我发现,我在响应拦截器里面将响应reject出去后,会进入errorHandler执行。 所以,umi-request的errorHandler,到底是在什么情况下才会执行呢? 下面是我的代码: fetch.js ![image](https://user-images.githubusercontent.com/17550199/148864838-af7583d9-4172-48d6-a824-53fd1a948f0d.png) config.ts ` import { message } from 'antd'; import { history } from '@@/core/history'; type CodeMsg = { [key: number]: string; };...

umi-request 在做拦截器的时候为请求 headers 中统一增加 Cookie 字段不能成功, 将 Cookie 字段修改为其他字段都是可行的,是怎么回事? headers 增加的字段为: ![image](https://user-images.githubusercontent.com/44257305/118908465-12e01980-b954-11eb-9c38-4e4aa87a6b92.png) 请求 header 头为: ![image](https://user-images.githubusercontent.com/44257305/118908436-065bc100-b954-11eb-9508-d90b1bf932a2.png)

![image](https://user-images.githubusercontent.com/13464485/183604070-a3f0d7df-acf6-4fd3-b75f-c01d5ea558c2.png) 我在 request的拦截器给每个请求加上了cancelToken ```javascript function addPending(config) { const pendingKey = getPendingKey(config); config.cancelToken = config.cancelToken || new Reqs.CancelToken((cancel) => { if (!pendingMap.has(pendingKey)) { pendingMap.set(pendingKey, cancel); } }); } async function errHandler(response:...

如下代码,请求可能抛错,逻辑也可能抛错。如何判断这个 error 对象是否为 `umi-request` 抛出来? 如果是 axios 的话可以用 axios.isAxiosError,umi-request 呢? ```js try { const data = await fetchData(); // 使用 umi-request 打请求 handleData(data); } catch (error) { // 如何判断这个 error...