Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResponseType设置为Json不生效 #58

Closed
imagehang opened this issue Aug 31, 2018 · 4 comments
Closed

ResponseType设置为Json不生效 #58

imagehang opened this issue Aug 31, 2018 · 4 comments

Comments

@imagehang
Copy link

ResponseType设置为JSON,返回的请求体还是String的,所以在接收请求结果时就报错DioError [DioErrorType.DEFAULT]: type 'String' is not a subtype of type 'Map<String, Object>'等

@wendux
Copy link
Contributor

wendux commented Sep 3, 2018

image
你先检查一下content-type是否正确

@wendux
Copy link
Contributor

wendux commented Sep 4, 2018

长时间没回复,先关了,若有问题再打开

@wendux wendux closed this as completed Sep 4, 2018
@imagehang
Copy link
Author

响应头中的content-type不为json,为text/html;charset=utf-8,,dio设置ResponseType能转为json吗

@wendux
Copy link
Contributor

wendux commented Sep 5, 2018

默认不能,除非你自定义一个transformer, 自定义transformer比较简单,示例可以在项目示例目录中找到。或者在响应拦截器中手动转一下。

:octocat: From gitme Android

AlexV525 pushed a commit that referenced this issue Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants