SOLR-6609: queryParams not respected for single-stream UpdateRequests

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1630576 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gregory Chanan 2014-10-09 20:00:32 +00:00
parent 3f566e6e91
commit 2da8697230
2 changed files with 19 additions and 4 deletions

View File

@ -330,12 +330,11 @@ public class HttpSolrServer extends SolrServer {
boolean isMultipart = ((this.useMultiPartPost && SolrRequest.METHOD.POST == request.getMethod())
|| ( streams != null && streams.size() > 1 )) && !hasNullStreamName;
// send server list and request list as query string params
ModifiableSolrParams queryParams = calculateQueryParams(this.queryParams, wparams);
queryParams.add(calculateQueryParams(request.getQueryParams(), wparams));
LinkedList<NameValuePair> postOrPutParams = new LinkedList<>();
if (streams == null || isMultipart) {
// send server list and request list as query string params
ModifiableSolrParams queryParams = calculateQueryParams(this.queryParams, wparams);
queryParams.add(calculateQueryParams(request.getQueryParams(), wparams));
String fullQueryUrl = url + ClientUtils.toQueryString( queryParams, false );
HttpEntityEnclosingRequestBase postOrPut = SolrRequest.METHOD.POST == request.getMethod() ?
new HttpPost(fullQueryUrl) : new HttpPut(fullQueryUrl);

View File

@ -640,5 +640,21 @@ public class BasicHttpSolrServerTest extends SolrJettyTestBase {
server.request(req);
} catch (Throwable t) {}
verifyServletState(server, req);
// test with both request and server query params with single stream
DebugServlet.clear();
req = new UpdateRequest();
req.add(new SolrInputDocument());
server.setQueryParams(setOf("serverOnly", "both"));
req.setQueryParams(setOf("requestOnly", "both"));
setReqParamsOf(req, "serverOnly", "requestOnly", "both", "neither");
try {
server.request(req);
} catch (Throwable t) {}
// NOTE: single stream requests send all the params
// as part of the query string. So add "neither" to the request
// so it passes the verification step.
req.setQueryParams(setOf("requestOnly", "both", "neither"));
verifyServletState(server, req);
}
}