Java Code Examples for org.springframework.mock.http.server.reactive.MockServerHttpRequest#BaseBuilder
The following examples show how to use
org.springframework.mock.http.server.reactive.MockServerHttpRequest#BaseBuilder .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RemoveHopByHopHeadersFilterTests.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
@Test public void happyPath() { MockServerHttpRequest.BaseBuilder<?> builder = MockServerHttpRequest .get("http://localhost/get"); HEADERS_REMOVED_ON_REQUEST .forEach(header -> builder.header(header, header + "1")); testFilter(MockServerWebExchange.from(builder)); }
Example 2
Source File: RemoveHopByHopHeadersFilterTests.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
@Test public void caseInsensitive() { MockServerHttpRequest.BaseBuilder<?> builder = MockServerHttpRequest .get("http://localhost/get"); HEADERS_REMOVED_ON_REQUEST .forEach(header -> builder.header(header.toLowerCase(), header + "1")); testFilter(MockServerWebExchange.from(builder)); }
Example 3
Source File: RemoveHopByHopHeadersFilterTests.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
@Test public void removesHeadersListedInConnectionHeader() { MockServerHttpRequest.BaseBuilder<?> builder = MockServerHttpRequest .get("http://localhost/get"); builder.header(HttpHeaders.CONNECTION, "upgrade", "keep-alive"); builder.header(HttpHeaders.UPGRADE, "WebSocket"); builder.header("Keep-Alive", "timeout:5"); testFilter(MockServerWebExchange.from(builder), "upgrade", "keep-alive"); }
Example 4
Source File: XForwardedRemoteAddressResolverTest.java From spring-cloud-gateway with Apache License 2.0 | 4 votes |
private MockServerHttpRequest.BaseBuilder emptyBuilder() { return MockServerHttpRequest.get("someUrl"); }
Example 5
Source File: XForwardedRemoteAddressResolverTest.java From spring-cloud-gateway with Apache License 2.0 | 4 votes |
private MockServerHttpRequest.BaseBuilder remoteAddressOnlyBuilder() { return MockServerHttpRequest.get("someUrl").remoteAddress(remote0000Address); }
Example 6
Source File: XForwardedRemoteAddressResolverTest.java From spring-cloud-gateway with Apache License 2.0 | 4 votes |
private MockServerHttpRequest.BaseBuilder oneTwoThreeBuilder() { return MockServerHttpRequest.get("someUrl").remoteAddress(remote0000Address) .header("X-Forwarded-For", "0.0.0.1, 0.0.0.2, 0.0.0.3"); }
Example 7
Source File: XForwardedRemoteAddressResolverTest.java From spring-cloud-gateway with Apache License 2.0 | 4 votes |
private ServerWebExchange buildExchange( MockServerHttpRequest.BaseBuilder requestBuilder) { return MockServerWebExchange.from(requestBuilder.build()); }
Example 8
Source File: MockServerWebExchange.java From spring-analysis-note with MIT License | 2 votes |
/** * Variant of {@link #from(MockServerHttpRequest)} with a mock request builder. * @param requestBuilder the builder for the mock request. * @return the exchange */ public static MockServerWebExchange from(MockServerHttpRequest.BaseBuilder<?> requestBuilder) { return builder(requestBuilder).build(); }
Example 9
Source File: MockServerWebExchange.java From spring-analysis-note with MIT License | 2 votes |
/** * Variant of {@link #builder(MockServerHttpRequest)} with a mock request builder. * @param requestBuilder the builder for the mock request. * @return the exchange builder * @since 5.1 */ public static MockServerWebExchange.Builder builder(MockServerHttpRequest.BaseBuilder<?> requestBuilder) { return new MockServerWebExchange.Builder(requestBuilder.build()); }
Example 10
Source File: MockServerWebExchange.java From java-technology-stack with MIT License | 2 votes |
/** * Variant of {@link #from(MockServerHttpRequest)} with a mock request builder. * @param requestBuilder the builder for the mock request. * @return the exchange */ public static MockServerWebExchange from(MockServerHttpRequest.BaseBuilder<?> requestBuilder) { return builder(requestBuilder).build(); }
Example 11
Source File: MockServerWebExchange.java From java-technology-stack with MIT License | 2 votes |
/** * Variant of {@link #builder(MockServerHttpRequest)} with a mock request builder. * @param requestBuilder the builder for the mock request. * @return the exchange builder * @since 5.1 */ public static MockServerWebExchange.Builder builder(MockServerHttpRequest.BaseBuilder<?> requestBuilder) { return new MockServerWebExchange.Builder(requestBuilder.build()); }