gpt4 book ai didi

使用名称值对的 Android Volley 发布请求

转载 作者:太空宇宙 更新时间:2023-11-03 11:09:44 25 4
gpt4 key购买 nike

我正在使用 volley用于向服务器发出发布请求的库。该库使用 Map<String, String>对于帖子参数。我的问题是想为同一个键设置多个值,这可以使用 NameValuePairs但它不能与 Volley 一起使用。提前致谢!

最佳答案

尝试覆盖下面的方法,它来自源代码:

/**
* Returns the raw POST or PUT body to be sent.
*
* @throws AuthFailureError in the event of auth failure
*/
public byte[] getBody() throws AuthFailureError {
Map<String, String> params = getParams();
if (params != null && params.size() > 0) {
return encodeParameters(params, getParamsEncoding());
}
return null;
}

返回要发送的原始 POST 或 PUT 正文。

所以用您的参数覆盖 getBody()

关于使用名称值对的 Android Volley 发布请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27640816/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com