use of com.artipie.http.rs.RsWithHeaders in project maven-adapter by artipie.
the class HeadProxySliceTest method passesStatusAndHeadersFromResponse.
@Test
void passesStatusAndHeadersFromResponse() {
final RsStatus status = RsStatus.CREATED;
final Headers.From headers = new Headers.From("abc", "123");
MatcherAssert.assertThat(new HeadProxySlice(new SliceSimple(new RsWithHeaders(new RsWithStatus(status), headers))), new SliceHasResponse(Matchers.allOf(new RsHasStatus(status), new RsHasHeaders(headers)), new RequestLine(RqMethod.HEAD, "/")));
}
use of com.artipie.http.rs.RsWithHeaders in project maven-adapter by artipie.
the class HeadProxySlice method response.
@Override
public Response response(final String line, final Iterable<Map.Entry<String, String>> headers, final Publisher<ByteBuffer> body) {
final CompletableFuture<Response> promise = new CompletableFuture<>();
this.client.response(line, Headers.EMPTY, Content.EMPTY).send((status, rsheaders, rsbody) -> {
promise.complete(new RsWithHeaders(new RsWithStatus(status), rsheaders));
return CompletableFuture.allOf();
});
return new AsyncResponse(promise);
}
Aggregations