Browse Source

Sync test fixture MockServerHttpRequest implementation with original

pull/35088/head
Sam Brannen 6 months ago
parent
commit
7ffd4e7cf8
  1. 28
      spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/server/reactive/MockServerHttpRequest.java
  2. 2
      spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerRequestTests.java

28
spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/server/reactive/MockServerHttpRequest.java

@ -282,15 +282,6 @@ public final class MockServerHttpRequest extends AbstractServerHttpRequest {
/** /**
* Add the given header values. * Add the given header values.
* @param headers the header values * @param headers the header values
* @deprecated in favor of {@link #headers(HttpHeaders)}
*/
@Deprecated(since = "7.0", forRemoval = true)
B headers(MultiValueMap<String, String> headers);
/**
* Add the given header values.
* @param headers the header values
* @since 7.0
*/ */
B headers(HttpHeaders headers); B headers(HttpHeaders headers);
@ -332,12 +323,6 @@ public final class MockServerHttpRequest extends AbstractServerHttpRequest {
*/ */
B ifUnmodifiedSince(long ifUnmodifiedSince); B ifUnmodifiedSince(long ifUnmodifiedSince);
/**
* Set the values of the {@code If-Match} header.
* @param ifMatches the new value of the header
*/
B ifMatch(String... ifMatches);
/** /**
* Set the values of the {@code If-None-Match} header. * Set the values of the {@code If-None-Match} header.
* @param ifNoneMatches the new value of the header * @param ifNoneMatches the new value of the header
@ -483,13 +468,6 @@ public final class MockServerHttpRequest extends AbstractServerHttpRequest {
return this; return this;
} }
@Override
@Deprecated(since = "7.0", forRemoval = true)
public BodyBuilder headers(MultiValueMap<String, String> headers) {
this.headers.putAll(headers);
return this;
}
@Override @Override
public BodyBuilder headers(HttpHeaders headers) { public BodyBuilder headers(HttpHeaders headers) {
this.headers.putAll(headers); this.headers.putAll(headers);
@ -538,12 +516,6 @@ public final class MockServerHttpRequest extends AbstractServerHttpRequest {
return this; return this;
} }
@Override
public BodyBuilder ifMatch(String... ifMatches) {
this.headers.setIfMatch(Arrays.asList(ifMatches));
return this;
}
@Override @Override
public BodyBuilder ifNoneMatch(String... ifNoneMatches) { public BodyBuilder ifNoneMatch(String... ifNoneMatches) {
this.headers.setIfNoneMatch(Arrays.asList(ifNoneMatches)); this.headers.setIfNoneMatch(Arrays.asList(ifNoneMatches));

2
spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerRequestTests.java

@ -480,7 +480,7 @@ class DefaultServerRequestTests {
@Test @Test
void ifMatchValueShouldMatchWhenETagMatches() { void ifMatchValueShouldMatchWhenETagMatches() {
MockServerHttpRequest mockRequest = MockServerHttpRequest.put("/") MockServerHttpRequest mockRequest = MockServerHttpRequest.put("/")
.ifMatch("\"first\"", "\"second\"").build(); .header(HttpHeaders.IF_MATCH, "\"first\"", "\"second\"").build();
DefaultServerRequest request = createRequest(mockRequest); DefaultServerRequest request = createRequest(mockRequest);
Mono<ServerResponse> result = request.checkNotModified("\"second\""); Mono<ServerResponse> result = request.checkNotModified("\"second\"");

Loading…
Cancel
Save