mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 08:24:13 +00:00
Add QUERY HTTP method
Signed-off-by: Mario Daniel Ruiz Saavedra <desiderantes93@gmail.com>
This commit is contained in:
committed by
Brian Clozel
parent
555ac3768d
commit
4a64537ac6
+1
-1
@@ -118,7 +118,7 @@ class RestTestClientTests {
|
||||
RestTestClientTests.this.client.options().uri("/test")
|
||||
.exchange()
|
||||
.expectStatus().isOk()
|
||||
.expectHeader().valueEquals("Allow", "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS")
|
||||
.expectHeader().valueEquals("Allow", "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS,QUERY")
|
||||
.expectBody().isEmpty();
|
||||
}
|
||||
|
||||
|
||||
+8
-3
@@ -31,6 +31,8 @@ import jakarta.servlet.ServletContext;
|
||||
import jakarta.servlet.http.Cookie;
|
||||
import org.assertj.core.api.ThrowingConsumer;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
@@ -418,18 +420,21 @@ class MockHttpServletRequestBuilderTests {
|
||||
assertThat(request.getParameterMap().get("foo")).containsExactly("bar", "baz");
|
||||
}
|
||||
|
||||
@Test
|
||||
void requestParameterFromRequestBodyFormData() {
|
||||
@ValueSource(strings = {"POST", "QUERY"})
|
||||
@ParameterizedTest()
|
||||
void requestParameterFromRequestBodyFormData(String methodName) {
|
||||
String contentType = "application/x-www-form-urlencoded;charset=UTF-8";
|
||||
String body = "name+1=value+1&name+2=value+A&name+2=value+B&name+3";
|
||||
|
||||
MockHttpServletRequest request = new MockHttpServletRequestBuilder(POST).uri("/foo")
|
||||
HttpMethod method = HttpMethod.valueOf(methodName);
|
||||
MockHttpServletRequest request = new MockHttpServletRequestBuilder(method).uri("/foo")
|
||||
.contentType(contentType).content(body.getBytes(UTF_8))
|
||||
.buildRequest(this.servletContext);
|
||||
|
||||
assertThat(request.getParameterMap().get("name 1")).containsExactly("value 1");
|
||||
assertThat(request.getParameterMap().get("name 2")).containsExactly("value A", "value B");
|
||||
assertThat(request.getParameterMap().get("name 3")).containsExactly((String) null);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user