From 84fcf5483c0d173d590f7db7fbf8bcd56cd6fca2 Mon Sep 17 00:00:00 2001 From: orimarko Date: Thu, 12 Nov 2026 16:14:33 +0200 Subject: [PATCH 1/7] #6743 [feature] Add HTTP QUERY method test using rungui and added unit test --- .../http/sampler/HTTPSamplerBase.java | 3 +- .../http/util/HTTPConstantsInterface.java | 1 + .../protocol/http/sampler/HttpQueryTest.java | 87 +++++++++++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/HttpQueryTest.java diff --git a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java index 43b446ed83b..eb9ccedb903 100644 --- a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java +++ b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java @@ -254,7 +254,8 @@ static int getMaxBytesToStorePerRequest() { HTTPConstants.UNLOCK, HTTPConstants.REPORT, HTTPConstants.MKCALENDAR, - HTTPConstants.SEARCH + HTTPConstants.SEARCH, + HTTPConstants.QUERY )); String userDefinedMethods = JMeterUtils.getPropDefault( "httpsampler.user_defined_methods", ""); diff --git a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java index 5defe6aee12..061a1081d4a 100644 --- a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java +++ b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java @@ -67,6 +67,7 @@ public interface HTTPConstantsInterface { // CHECKSTYLE IGNORE InterfaceIsType String REPORT = "REPORT"; // $NON-NLS-1$ String MKCALENDAR = "MKCALENDAR"; // $NON-NLS-1$ String SEARCH = "SEARCH"; // $NON-NLS-1$ + String QUERY = "QUERY"; // $NON-NLS-1$ String HEADER_AUTHORIZATION = "Authorization"; // $NON-NLS-1$ String HEADER_COOKIE = "Cookie"; // $NON-NLS-1$ String HEADER_COOKIE_IN_REQUEST = "Cookie:"; // $NON-NLS-1$ diff --git a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/HttpQueryTest.java b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/HttpQueryTest.java new file mode 100644 index 00000000000..f82b70be118 --- /dev/null +++ b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/HttpQueryTest.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jmeter.protocol.http.sampler; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.net.InetSocketAddress; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.atomic.AtomicReference; + +import com.sun.net.httpserver.HttpServer; +import org.apache.jmeter.junit.JMeterTestCase; +import org.apache.jmeter.samplers.SampleResult; +import org.apache.jorphan.test.JMeterSerialTest; +import org.junit.jupiter.api.Test; + +public class HttpQueryTest extends JMeterTestCase implements JMeterSerialTest { + + @Test + void querySendsRequestBody() throws Exception { + String expectedBody = "{\"name\":\"Ori\"}"; + AtomicReference receivedMethod = new AtomicReference<>(); + AtomicReference receivedBody = new AtomicReference<>(); + + // Port 0 lets the operating system select an available port. + HttpServer server = HttpServer.create( + new InetSocketAddress("127.0.0.1", 0), 0); + + server.createContext("/search", exchange -> { + try { + receivedMethod.set(exchange.getRequestMethod()); + receivedBody.set(new String( + exchange.getRequestBody().readAllBytes(), + StandardCharsets.UTF_8)); + + byte[] response = "OK".getBytes(StandardCharsets.UTF_8); + exchange.sendResponseHeaders(200, response.length); + try (var output = exchange.getResponseBody()) { + output.write(response); + } + } finally { + exchange.close(); + } + }); + + server.start(); + try { + HTTPSamplerProxy sampler = + new HTTPSamplerProxy(HTTPSamplerFactory.IMPL_HTTP_CLIENT4); + sampler.setProtocol("http"); + sampler.setDomain("127.0.0.1"); + sampler.setPort(server.getAddress().getPort()); + sampler.setPath("/search"); + sampler.setMethod("QUERY"); + sampler.setConnectTimeout("5000"); + sampler.setResponseTimeout("5000"); + sampler.setPostBodyRaw(true); + sampler.addNonEncodedArgument("", expectedBody, ""); + + SampleResult result = sampler.sample(); + + assertTrue(result.isSuccessful(), + "Sampler failed: " + result.getResponseMessage()); + assertEquals("200", result.getResponseCode()); + assertEquals("QUERY", receivedMethod.get()); + assertEquals(expectedBody, receivedBody.get()); + } finally { + server.stop(0); + } + } +} From 8e2f92e1a0a30e4d82efc88002e4d495e9eb6f6a Mon Sep 17 00:00:00 2001 From: orimarko Date: Thu, 12 Nov 2026 20:13:43 +0200 Subject: [PATCH 2/7] #6743 [feature] Add HTTP QUERY method test using rungui and added unit test --- xdocs/usermanual/component_reference.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xdocs/usermanual/component_reference.xml b/xdocs/usermanual/component_reference.xml index 2e64ec36578..7cc0530995e 100644 --- a/xdocs/usermanual/component_reference.xml +++ b/xdocs/usermanual/component_reference.xml @@ -272,7 +272,7 @@ https.default.protocol=SSLv3 JAVA implementation). With HttpClient4 or HttpClient5, the following methods related to WebDav are also allowed: COPY, LOCK, MKCOL, MOVE, PROPFIND, PROPPATCH, UNLOCK, REPORT, MKCALENDAR, - SEARCH. + SEARCH, QUERY.

More methods can be pre-defined for the HttpClient4 by using the JMeter property httpsampler.user_defined_methods.

From 05d09687dda230e5f7f4595eec983498802ab835 Mon Sep 17 00:00:00 2001 From: orimarko Date: Thu, 12 Nov 2026 20:40:14 +0200 Subject: [PATCH 3/7] #6743 [feature] Add HTTP QUERY method test using rungui and added unit test --- .../jmeter/protocol/http/sampler/HttpQueryTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/HttpQueryTest.java b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/HttpQueryTest.java index f82b70be118..5ee5d55b033 100644 --- a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/HttpQueryTest.java +++ b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/HttpQueryTest.java @@ -1,12 +1,12 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to you under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -24,12 +24,13 @@ import java.nio.charset.StandardCharsets; import java.util.concurrent.atomic.AtomicReference; -import com.sun.net.httpserver.HttpServer; import org.apache.jmeter.junit.JMeterTestCase; import org.apache.jmeter.samplers.SampleResult; import org.apache.jorphan.test.JMeterSerialTest; import org.junit.jupiter.api.Test; +import com.sun.net.httpserver.HttpServer; + public class HttpQueryTest extends JMeterTestCase implements JMeterSerialTest { @Test From 3cebb6cf5a902ff6fe1e37745dd5d2363c9e2604 Mon Sep 17 00:00:00 2001 From: orimarko Date: Fri, 20 Nov 2026 19:57:35 +0200 Subject: [PATCH 4/7] #6743 [feature] Add HTTP QUERY method code review changes in test and docs --- .../protocol/http/sampler/HttpQueryTest.java | 88 ------------------ .../protocol/http/sampler/TestHttpQuery.java | 90 +++++++++++++++++++ xdocs/changes.xml | 2 + xdocs/usermanual/component_reference.xml | 3 +- 4 files changed, 94 insertions(+), 89 deletions(-) delete mode 100644 src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/HttpQueryTest.java create mode 100644 src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java diff --git a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/HttpQueryTest.java b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/HttpQueryTest.java deleted file mode 100644 index 5ee5d55b033..00000000000 --- a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/HttpQueryTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jmeter.protocol.http.sampler; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.net.InetSocketAddress; -import java.nio.charset.StandardCharsets; -import java.util.concurrent.atomic.AtomicReference; - -import org.apache.jmeter.junit.JMeterTestCase; -import org.apache.jmeter.samplers.SampleResult; -import org.apache.jorphan.test.JMeterSerialTest; -import org.junit.jupiter.api.Test; - -import com.sun.net.httpserver.HttpServer; - -public class HttpQueryTest extends JMeterTestCase implements JMeterSerialTest { - - @Test - void querySendsRequestBody() throws Exception { - String expectedBody = "{\"name\":\"Ori\"}"; - AtomicReference receivedMethod = new AtomicReference<>(); - AtomicReference receivedBody = new AtomicReference<>(); - - // Port 0 lets the operating system select an available port. - HttpServer server = HttpServer.create( - new InetSocketAddress("127.0.0.1", 0), 0); - - server.createContext("/search", exchange -> { - try { - receivedMethod.set(exchange.getRequestMethod()); - receivedBody.set(new String( - exchange.getRequestBody().readAllBytes(), - StandardCharsets.UTF_8)); - - byte[] response = "OK".getBytes(StandardCharsets.UTF_8); - exchange.sendResponseHeaders(200, response.length); - try (var output = exchange.getResponseBody()) { - output.write(response); - } - } finally { - exchange.close(); - } - }); - - server.start(); - try { - HTTPSamplerProxy sampler = - new HTTPSamplerProxy(HTTPSamplerFactory.IMPL_HTTP_CLIENT4); - sampler.setProtocol("http"); - sampler.setDomain("127.0.0.1"); - sampler.setPort(server.getAddress().getPort()); - sampler.setPath("/search"); - sampler.setMethod("QUERY"); - sampler.setConnectTimeout("5000"); - sampler.setResponseTimeout("5000"); - sampler.setPostBodyRaw(true); - sampler.addNonEncodedArgument("", expectedBody, ""); - - SampleResult result = sampler.sample(); - - assertTrue(result.isSuccessful(), - "Sampler failed: " + result.getResponseMessage()); - assertEquals("200", result.getResponseCode()); - assertEquals("QUERY", receivedMethod.get()); - assertEquals(expectedBody, receivedBody.get()); - } finally { - server.stop(0); - } - } -} diff --git a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java new file mode 100644 index 00000000000..7016d60afeb --- /dev/null +++ b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jmeter.protocol.http.sampler; + +import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; +import com.github.tomakehurst.wiremock.junit5.WireMockTest; + +import org.apache.jmeter.junit.JMeterTestCase; +import org.apache.jmeter.protocol.http.util.HTTPConstants; +import org.apache.jmeter.samplers.SampleResult; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import java.util.Arrays; + + +@WireMockTest +class TestHttpQuery extends JMeterTestCase { + + private static HTTPSamplerProxy querySampler(String impl, WireMockRuntimeInfo server) { + HTTPSamplerProxy sampler = new HTTPSamplerProxy(impl); + sampler.setProtocol("http"); + sampler.setDomain("localhost"); + sampler.setPort(server.getHttpPort()); + sampler.setPath("/search"); + sampler.setMethod(HTTPConstants.QUERY); + sampler.setConnectTimeout("5000"); + sampler.setResponseTimeout("5000"); + return sampler; + } + + @Test + void queryIsOfferedInMethodList() { + assertTrue(Arrays.asList(HTTPSamplerBase.getValidMethodsAsArray()).contains(HTTPConstants.QUERY)); + } + + @ParameterizedTest + @ValueSource(strings = {HTTPSamplerFactory.IMPL_HTTP_CLIENT4, HTTPSamplerFactory.IMPL_HTTP_CLIENT5}) + void querySendsRawBody(String impl, WireMockRuntimeInfo server) { + server.getWireMock().register(request("QUERY", urlEqualTo("/search")) + .willReturn(aResponse().withStatus(200).withBody("OK"))); + HTTPSamplerProxy sampler = querySampler(impl, server); + sampler.setPostBodyRaw(true); + sampler.addNonEncodedArgument("", "{\"q\":\"jmeter\"}", ""); + SampleResult res = sampler.sample(); + assertTrue(res.isSuccessful(), res.getResponseMessage()); + server.getWireMock().verifyThat(1, requestedFor("QUERY", urlEqualTo("/search")) + .withRequestBody(equalTo("{\"q\":\"jmeter\"}"))); + } + + @ParameterizedTest + @ValueSource(strings = {HTTPSamplerFactory.IMPL_HTTP_CLIENT4, HTTPSamplerFactory.IMPL_HTTP_CLIENT5}) + void querySendsFormParameters(String impl, WireMockRuntimeInfo server) { + server.getWireMock().register(request("QUERY", urlEqualTo("/search")) + .willReturn(aResponse().withStatus(200))); + HTTPSamplerProxy sampler = querySampler(impl, server); + sampler.addArgument("a", "1"); + sampler.addArgument("b", "x y"); + SampleResult res = sampler.sample(); + assertTrue(res.isSuccessful(), res.getResponseMessage()); + server.getWireMock().verifyThat(1, requestedFor("QUERY", urlEqualTo("/search")) + .withRequestBody(equalTo("a=1&b=x+y"))); + } + + @Test + void javaImplementationRejectsQuery(WireMockRuntimeInfo server) { + SampleResult res = querySampler(HTTPSamplerFactory.IMPL_JAVA, server).sample(); + assertFalse(res.isSuccessful()); + } +} diff --git a/xdocs/changes.xml b/xdocs/changes.xml index e2350f71766..deb81dace0d 100644 --- a/xdocs/changes.xml +++ b/xdocs/changes.xml @@ -99,6 +99,8 @@ Summary
  • 6742Add the HTTP Version combo box (property HTTPSampler.httpVersion) to the HTTP Request sampler and the HTTP Request Defaults, so the HTTP version can be selected per sampler instead of only globally with the httpclient.version property. An empty value keeps using that property, which now defaults to HTTP/1.1.
  • 6742Send a Host header of the HTTP Header Manager without its port when that port is the default one of the URL in the HttpClient5 sampler implementation, as the HttpClient4 implementation does.
  • 6742Follow automatic redirects to another host in the HttpClient5 sampler implementation, like the HttpClient4 implementation does, instead of returning the redirect when the request carries cookies or credentials. Each redirect is sent with the cookies of the HTTP Cookie Manager and the credentials of the HTTP Authorization Manager for its own URL, the cookies the redirects set are kept in the Cookie Manager, and a Cookie or Authorization header of the HTTP Header Manager is only sent to the host of the initial URL. The number of redirects is limited by httpsampler.max_redirects, and cookies are only handled by the Cookie Manager, so none are sent without one.
  • +
  • 67436854Add QUERY to the list of HTTP Request methods
  • . If httpsampler.user_defined_methods already contains + QUERY, it will appear twice in the method list.

    HTTP/2 support for the HttpClient5 sampler implementation:

    diff --git a/xdocs/usermanual/component_reference.xml b/xdocs/usermanual/component_reference.xml index 7cc0530995e..7bbce38e78a 100644 --- a/xdocs/usermanual/component_reference.xml +++ b/xdocs/usermanual/component_reference.xml @@ -272,7 +272,8 @@ https.default.protocol=SSLv3 JAVA implementation). With HttpClient4 or HttpClient5, the following methods related to WebDav are also allowed: COPY, LOCK, MKCOL, MOVE, PROPFIND, PROPPATCH, UNLOCK, REPORT, MKCALENDAR, - SEARCH, QUERY. + SEARCH. The QUERY method (safe and idempotent request with a body) is also + available with HttpClient4 or HttpClient5; it is not supported by the JAVA implementation.

    More methods can be pre-defined for the HttpClient4 by using the JMeter property httpsampler.user_defined_methods.

    From 42e0854e78aa537813db65ad756ba98d5b2a5f10 Mon Sep 17 00:00:00 2001 From: orimarko Date: Sat, 21 Nov 2026 07:42:05 +0200 Subject: [PATCH 5/7] #6743 [feature] HTTP QUERY method fix style --- .../apache/jmeter/protocol/http/sampler/TestHttpQuery.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java index 7016d60afeb..408cbac64d5 100644 --- a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java +++ b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java @@ -21,8 +21,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; -import com.github.tomakehurst.wiremock.junit5.WireMockTest; +import java.util.Arrays; import org.apache.jmeter.junit.JMeterTestCase; import org.apache.jmeter.protocol.http.util.HTTPConstants; @@ -31,7 +30,8 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import java.util.Arrays; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; +import com.github.tomakehurst.wiremock.junit5.WireMockTest; @WireMockTest From 65e05f5de51b83f98d26aecd3b1cb6abbcf5009f Mon Sep 17 00:00:00 2001 From: orimarko Date: Sat, 21 Nov 2026 07:49:35 +0200 Subject: [PATCH 6/7] #6743 [feature] HTTP QUERY method fix style and doc --- .../apache/jmeter/protocol/http/sampler/TestHttpQuery.java | 6 +++++- xdocs/changes.xml | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java index 408cbac64d5..61502dc7833 100644 --- a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java +++ b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java @@ -17,7 +17,11 @@ package org.apache.jmeter.protocol.http.sampler; -import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.request; +import static com.github.tomakehurst.wiremock.client.WireMock.requestedFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/xdocs/changes.xml b/xdocs/changes.xml index deb81dace0d..cb70f8a3e6f 100644 --- a/xdocs/changes.xml +++ b/xdocs/changes.xml @@ -99,8 +99,8 @@ Summary
  • 6742Add the HTTP Version combo box (property HTTPSampler.httpVersion) to the HTTP Request sampler and the HTTP Request Defaults, so the HTTP version can be selected per sampler instead of only globally with the httpclient.version property. An empty value keeps using that property, which now defaults to HTTP/1.1.
  • 6742Send a Host header of the HTTP Header Manager without its port when that port is the default one of the URL in the HttpClient5 sampler implementation, as the HttpClient4 implementation does.
  • 6742Follow automatic redirects to another host in the HttpClient5 sampler implementation, like the HttpClient4 implementation does, instead of returning the redirect when the request carries cookies or credentials. Each redirect is sent with the cookies of the HTTP Cookie Manager and the credentials of the HTTP Authorization Manager for its own URL, the cookies the redirects set are kept in the Cookie Manager, and a Cookie or Authorization header of the HTTP Header Manager is only sent to the host of the initial URL. The number of redirects is limited by httpsampler.max_redirects, and cookies are only handled by the Cookie Manager, so none are sent without one.
  • -
  • 67436854Add QUERY to the list of HTTP Request methods
  • . If httpsampler.user_defined_methods already contains - QUERY, it will appear twice in the method list. +
  • 67436854Add QUERY to the list of HTTP Request methods. If httpsampler.user_defined_methods already contains + QUERY, it will appear twice in the method list.
  • HTTP/2 support for the HttpClient5 sampler implementation:

    From c76ae5395370facddebb20cc95d2df1edefb5c91 Mon Sep 17 00:00:00 2001 From: Milamber Date: Sat, 21 Nov 2026 17:30:39 +0300 Subject: [PATCH 7/7] Fix indentation in TestHttpQuery Generated-by: Claude Code 2.1.330 (Claude Opus 5.5) --- .../protocol/http/sampler/TestHttpQuery.java | 93 +++++++++---------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java index 61502dc7833..c2d5f784ae2 100644 --- a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java +++ b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/sampler/TestHttpQuery.java @@ -37,58 +37,57 @@ import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import com.github.tomakehurst.wiremock.junit5.WireMockTest; - @WireMockTest class TestHttpQuery extends JMeterTestCase { - private static HTTPSamplerProxy querySampler(String impl, WireMockRuntimeInfo server) { - HTTPSamplerProxy sampler = new HTTPSamplerProxy(impl); - sampler.setProtocol("http"); - sampler.setDomain("localhost"); - sampler.setPort(server.getHttpPort()); - sampler.setPath("/search"); - sampler.setMethod(HTTPConstants.QUERY); - sampler.setConnectTimeout("5000"); - sampler.setResponseTimeout("5000"); - return sampler; - } + private static HTTPSamplerProxy querySampler(String impl, WireMockRuntimeInfo server) { + HTTPSamplerProxy sampler = new HTTPSamplerProxy(impl); + sampler.setProtocol("http"); + sampler.setDomain("localhost"); + sampler.setPort(server.getHttpPort()); + sampler.setPath("/search"); + sampler.setMethod(HTTPConstants.QUERY); + sampler.setConnectTimeout("5000"); + sampler.setResponseTimeout("5000"); + return sampler; + } - @Test - void queryIsOfferedInMethodList() { - assertTrue(Arrays.asList(HTTPSamplerBase.getValidMethodsAsArray()).contains(HTTPConstants.QUERY)); - } + @Test + void queryIsOfferedInMethodList() { + assertTrue(Arrays.asList(HTTPSamplerBase.getValidMethodsAsArray()).contains(HTTPConstants.QUERY)); + } - @ParameterizedTest - @ValueSource(strings = {HTTPSamplerFactory.IMPL_HTTP_CLIENT4, HTTPSamplerFactory.IMPL_HTTP_CLIENT5}) - void querySendsRawBody(String impl, WireMockRuntimeInfo server) { - server.getWireMock().register(request("QUERY", urlEqualTo("/search")) - .willReturn(aResponse().withStatus(200).withBody("OK"))); - HTTPSamplerProxy sampler = querySampler(impl, server); - sampler.setPostBodyRaw(true); - sampler.addNonEncodedArgument("", "{\"q\":\"jmeter\"}", ""); - SampleResult res = sampler.sample(); - assertTrue(res.isSuccessful(), res.getResponseMessage()); - server.getWireMock().verifyThat(1, requestedFor("QUERY", urlEqualTo("/search")) - .withRequestBody(equalTo("{\"q\":\"jmeter\"}"))); - } + @ParameterizedTest + @ValueSource(strings = {HTTPSamplerFactory.IMPL_HTTP_CLIENT4, HTTPSamplerFactory.IMPL_HTTP_CLIENT5}) + void querySendsRawBody(String impl, WireMockRuntimeInfo server) { + server.getWireMock().register(request("QUERY", urlEqualTo("/search")) + .willReturn(aResponse().withStatus(200).withBody("OK"))); + HTTPSamplerProxy sampler = querySampler(impl, server); + sampler.setPostBodyRaw(true); + sampler.addNonEncodedArgument("", "{\"q\":\"jmeter\"}", ""); + SampleResult res = sampler.sample(); + assertTrue(res.isSuccessful(), res.getResponseMessage()); + server.getWireMock().verifyThat(1, requestedFor("QUERY", urlEqualTo("/search")) + .withRequestBody(equalTo("{\"q\":\"jmeter\"}"))); + } - @ParameterizedTest - @ValueSource(strings = {HTTPSamplerFactory.IMPL_HTTP_CLIENT4, HTTPSamplerFactory.IMPL_HTTP_CLIENT5}) - void querySendsFormParameters(String impl, WireMockRuntimeInfo server) { - server.getWireMock().register(request("QUERY", urlEqualTo("/search")) - .willReturn(aResponse().withStatus(200))); - HTTPSamplerProxy sampler = querySampler(impl, server); - sampler.addArgument("a", "1"); - sampler.addArgument("b", "x y"); - SampleResult res = sampler.sample(); - assertTrue(res.isSuccessful(), res.getResponseMessage()); - server.getWireMock().verifyThat(1, requestedFor("QUERY", urlEqualTo("/search")) - .withRequestBody(equalTo("a=1&b=x+y"))); - } + @ParameterizedTest + @ValueSource(strings = {HTTPSamplerFactory.IMPL_HTTP_CLIENT4, HTTPSamplerFactory.IMPL_HTTP_CLIENT5}) + void querySendsFormParameters(String impl, WireMockRuntimeInfo server) { + server.getWireMock().register(request("QUERY", urlEqualTo("/search")) + .willReturn(aResponse().withStatus(200))); + HTTPSamplerProxy sampler = querySampler(impl, server); + sampler.addArgument("a", "1"); + sampler.addArgument("b", "x y"); + SampleResult res = sampler.sample(); + assertTrue(res.isSuccessful(), res.getResponseMessage()); + server.getWireMock().verifyThat(1, requestedFor("QUERY", urlEqualTo("/search")) + .withRequestBody(equalTo("a=1&b=x+y"))); + } - @Test - void javaImplementationRejectsQuery(WireMockRuntimeInfo server) { - SampleResult res = querySampler(HTTPSamplerFactory.IMPL_JAVA, server).sample(); - assertFalse(res.isSuccessful()); - } + @Test + void javaImplementationRejectsQuery(WireMockRuntimeInfo server) { + SampleResult res = querySampler(HTTPSamplerFactory.IMPL_JAVA, server).sample(); + assertFalse(res.isSuccessful()); + } }