Skip to content

[Support] 接口返回的若是204状态码,HttpClient访问时会报错 Unable to parse response data。这里说的是@midwayjs/core里的HttpClient #3983

Closed Answered by googoo625
googoo625 asked this question in Q&A
Discussion options

You must be logged in to vote

问题解决办法:
1)访问204接口时,dataType不要传json
2)避免重复使用HttpClient对象,每次访问都应新建一个。
感谢帮助!

还有,期待HttpClient稍做完善,避免使用Object.assign导致的defaultOptions属性增加,毕竟重复使用httpClient对象的情况是有可能的。

Replies: 7 comments 14 replies

Comment options

You must be logged in to vote
5 replies
@googoo625
Comment options

@czy88840616
Comment options

@googoo625
Comment options

@czy88840616
Comment options

@waitingsong
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@googoo625
Comment options

@waitingsong
Comment options

@czy88840616
Comment options

@googoo625
Comment options

Comment options

You must be logged in to vote
2 replies
@googoo625
Comment options

@czy88840616
Comment options

Comment options

You must be logged in to vote
2 replies
@waitingsong
Comment options

@googoo625
Comment options

Comment options

You must be logged in to vote
1 reply
@czy88840616
Comment options

Answer selected by googoo625
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
type: bug for issue something isn't working type: question / discussion This issue or pull request need be discussion
3 participants