DefaultAggregatedHttpRequest extends AbstractAggregatedHttpMessage implements AggregatedHttpRequest { @Override public RequestHeaders headers() { return headers; } DefaultAggregatedHttpRequest(RequestHeaders headers, HttpData content,
                                 HttpHeaders trailers); @Override RequestHeaders headers(); @Override HttpMethod method(); @Override String path(); @Override String scheme(); @Override String authority(); @Override int hashCode(); @Override boolean equals(@Nullable Object obj); @Override String toString();  }
@Test void toHttpRequest() { final AggregatedHttpRequest aReq = AggregatedHttpRequest.of( HttpMethod.POST, "/foo", PLAIN_TEXT_UTF_8, "bar"); final HttpRequest req = aReq.toHttpRequest(); assertThat(req.headers()).isEqualTo(RequestHeaders.of(HttpMethod.POST, "/foo", CONTENT_TYPE, PLAIN_TEXT_UTF_8, CONTENT_LENGTH, 3)); StepVerifier.create(req) .expectNext(HttpData.of(StandardCharsets.UTF_8, "bar")) .expectComplete() .verify(); }
@Test void toHttpRequestWithoutContent() { final AggregatedHttpRequest aReq = AggregatedHttpRequest.of(HttpMethod.GET, "/bar"); final HttpRequest req = aReq.toHttpRequest(); assertThat(req.headers()).isEqualTo(RequestHeaders.of(HttpMethod.GET, "/bar")); StepVerifier.create(req) .expectComplete() .verify(); }
@Test void toHttpRequestWithTrailers() { final AggregatedHttpRequest aReq = AggregatedHttpRequest.of( HttpMethod.PUT, "/baz", PLAIN_TEXT_UTF_8, HttpData.ofUtf8("bar"), HttpHeaders.of(CONTENT_MD5, "37b51d194a7513e45b56f6524f2d51f2")); final HttpRequest req = aReq.toHttpRequest(); assertThat(req.headers()).isEqualTo(RequestHeaders.of(HttpMethod.PUT, "/baz", CONTENT_TYPE, PLAIN_TEXT_UTF_8, CONTENT_LENGTH, 3)); StepVerifier.create(req) .expectNext(HttpData.of(StandardCharsets.UTF_8, "bar")) .expectNext(HttpHeaders.of(CONTENT_MD5, "37b51d194a7513e45b56f6524f2d51f2")) .expectComplete() .verify(); }