Skip to content

http response 拦截器导致无法获得response headers信息 #1

@longmain

Description

@longmain

src/utils/api.js 中通过设置http response 拦截器,实现了对异常情况的处理。
但对于正常情况下,仅反回data,而不反回headers信息,对于今后逻辑中需要用到headers信息的情况是一个障碍。
在后台代码中通过ResultUtil仅设置了一些简单的headers信息,例如status code和message。但若是发生了错误情况,就不会返回data了,也不会用到result了;若是正常情况,所有的code均为200,设置这些信息也没用。况且,headers中的一些其他信息在通过拦截器时被拦截下来了。
建议返回整个response而不是仅返回data。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions