对 android 开发相当陌生。我正在尝试使用改造来发送发布请求。在我的改造日志中,我看到了
Content-Type: text/plain; charset=utf-8
我发现只有在我使用内容类型时请求才会起作用:
application/x-www-form-urlencoded
我搜索了谷歌并没有找到明确设置内容类型的明确方法。有人知道怎么做吗?
最佳答案
在您定义服务的类中,修改相关方法以遵循以下模式:
@FormUrlEncoded
@POST/GET/PUT/DELETE("/your_endpoint")
Object yourMethodName(@Field("your_field") String yourField,...);
关于安卓改造 : content type as application/x-www-form-urlencoded,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28291006/