![](/img/trans.png)
[英]How to pass parameters to POST request in Retrofit - Android
[英]How to pass two parameters in a post request?
我有一个以下列方式发送的发布请求:
final private ObjectMapper mapper;
...
...
Response response =target.request().post(Entity.entity(mapper.writeValueAsString(feedbackFilterDataForDA),
APPLICATION_JSON));
请求转到 function 类型:
public Response getData(FeedbackFilterDataForDA f,ArrayList<String> a) {
}
我应该如何更改发布请求以将两个参数都作为输入?
我看到三个选项:
Enhance the JSON to include the additional information, eg by wrapping the current JSON in another JSON Object with 2 properties.
将数据发布为application/x-www-form-urlencoded
而不是application/json
,其中一个值是 JSON 有效负载。
将数据发布为multipart/form-data
而不是application/json
,其中一部分是 JSON 有效负载。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.