diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java index a2d741175c7..d21c4b5606c 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java @@ -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 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); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java index 017c94ab967..f2e0d981a4d 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java @@ -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); } }