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

[Question] why {...res} always get {} even if res is a validate Response

Open hanalice opened this issue 2 years ago • 1 comments

I put the following configuration in app.tsx, console always output {} which I expect extending response data with my customize data, but it doesn't work. What should I do to extend response data? And why does this happen?

export const request: RequestConfig = {
    responseInterceptors: [
        (res: Response) => {
            console.log(res.status);  // this line can get the right http status
            console.log({...res});  // this line will always output {}
            return res;
        },
    ],
};

hanalice avatar Mar 03 '22 03:03 hanalice

@clock157 @yesmeck @yutingzhao1991

hello, anyone can help?

hanalice avatar Mar 06 '22 14:03 hanalice