4

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

4

1 回答 1

0

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

/**
 * 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()用你的参数覆盖。

于 2014-12-24T18:26:36.897 回答