使用名称值对的Android排球请求

时间:2014-12-24 18:16:51

标签: android hashmap http-post android-volley basicnamevaluepair

我正在使用volley库向服务器发出帖子请求。该库使用Map<String, String>作为post参数。我的问题是希望为同一个键设置多个值,可以使用NameValuePairs,但不能与齐射一起使用。提前谢谢!

1 个答案:

答案 0 :(得分: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()

相关问题