|
|
|
@ -76,15 +76,15 @@ public final class MockServerHttpRequest extends AbstractServerHttpRequest { |
|
|
|
|
|
|
|
|
|
|
|
private MockServerHttpRequest(String httpMethod, |
|
|
|
private MockServerHttpRequest(String httpMethod, |
|
|
|
URI uri, @Nullable String contextPath, HttpHeaders headers, MultiValueMap<String, HttpCookie> cookies, |
|
|
|
URI uri, @Nullable String contextPath, HttpHeaders headers, MultiValueMap<String, HttpCookie> cookies, |
|
|
|
@Nullable InetSocketAddress remoteAddress, @Nullable InetSocketAddress localAddress, |
|
|
|
@Nullable InetSocketAddress localAddress, @Nullable InetSocketAddress remoteAddress, |
|
|
|
@Nullable SslInfo sslInfo, Publisher<? extends DataBuffer> body) { |
|
|
|
@Nullable SslInfo sslInfo, Publisher<? extends DataBuffer> body) { |
|
|
|
|
|
|
|
|
|
|
|
super(uri, contextPath, headers); |
|
|
|
super(uri, contextPath, headers); |
|
|
|
Assert.isTrue(StringUtils.hasText(httpMethod), "HTTP method is required."); |
|
|
|
Assert.isTrue(StringUtils.hasText(httpMethod), "HTTP method is required."); |
|
|
|
this.httpMethod = httpMethod; |
|
|
|
this.httpMethod = httpMethod; |
|
|
|
this.cookies = cookies; |
|
|
|
this.cookies = cookies; |
|
|
|
this.remoteAddress = remoteAddress; |
|
|
|
|
|
|
|
this.localAddress = localAddress; |
|
|
|
this.localAddress = localAddress; |
|
|
|
|
|
|
|
this.remoteAddress = remoteAddress; |
|
|
|
this.sslInfo = sslInfo; |
|
|
|
this.sslInfo = sslInfo; |
|
|
|
this.body = Flux.from(body); |
|
|
|
this.body = Flux.from(body); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -382,9 +382,9 @@ public final class MockServerHttpRequest extends AbstractServerHttpRequest { |
|
|
|
* @see BodyBuilder#body(String) |
|
|
|
* @see BodyBuilder#body(String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
MockServerHttpRequest build(); |
|
|
|
MockServerHttpRequest build(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* A builder that adds a body to the request. |
|
|
|
* A builder that adds a body to the request. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -423,7 +423,6 @@ public final class MockServerHttpRequest extends AbstractServerHttpRequest { |
|
|
|
* @return the built request entity |
|
|
|
* @return the built request entity |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
MockServerHttpRequest body(String body); |
|
|
|
MockServerHttpRequest body(String body); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -597,7 +596,7 @@ public final class MockServerHttpRequest extends AbstractServerHttpRequest { |
|
|
|
public MockServerHttpRequest body(Publisher<? extends DataBuffer> body) { |
|
|
|
public MockServerHttpRequest body(Publisher<? extends DataBuffer> body) { |
|
|
|
applyCookiesIfNecessary(); |
|
|
|
applyCookiesIfNecessary(); |
|
|
|
return new MockServerHttpRequest(this.methodValue, getUrlToUse(), this.contextPath, |
|
|
|
return new MockServerHttpRequest(this.methodValue, getUrlToUse(), this.contextPath, |
|
|
|
this.headers, this.cookies, this.remoteAddress, this.localAddress, this.sslInfo, body); |
|
|
|
this.headers, this.cookies, this.localAddress, this.remoteAddress, this.sslInfo, body); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void applyCookiesIfNecessary() { |
|
|
|
private void applyCookiesIfNecessary() { |
|
|
|
@ -610,11 +609,9 @@ public final class MockServerHttpRequest extends AbstractServerHttpRequest { |
|
|
|
private URI getUrlToUse() { |
|
|
|
private URI getUrlToUse() { |
|
|
|
MultiValueMap<String, String> params = |
|
|
|
MultiValueMap<String, String> params = |
|
|
|
this.queryParamsBuilder.buildAndExpand().encode().getQueryParams(); |
|
|
|
this.queryParamsBuilder.buildAndExpand().encode().getQueryParams(); |
|
|
|
|
|
|
|
|
|
|
|
if (!params.isEmpty()) { |
|
|
|
if (!params.isEmpty()) { |
|
|
|
return UriComponentsBuilder.fromUri(this.url).queryParams(params).build(true).toUri(); |
|
|
|
return UriComponentsBuilder.fromUri(this.url).queryParams(params).build(true).toUri(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return this.url; |
|
|
|
return this.url; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|