Search in sources :

Example 1 with RsWithHeaders

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, "/")));
}
Also used : RequestLine(com.artipie.http.rq.RequestLine) SliceHasResponse(com.artipie.http.hm.SliceHasResponse) RsWithStatus(com.artipie.http.rs.RsWithStatus) RsHasStatus(com.artipie.http.hm.RsHasStatus) RsWithHeaders(com.artipie.http.rs.RsWithHeaders) RsHasHeaders(com.artipie.http.hm.RsHasHeaders) Headers(com.artipie.http.Headers) RsWithHeaders(com.artipie.http.rs.RsWithHeaders) RsStatus(com.artipie.http.rs.RsStatus) RsHasHeaders(com.artipie.http.hm.RsHasHeaders) SliceSimple(com.artipie.http.slice.SliceSimple) Test(org.junit.jupiter.api.Test)

Example 2 with RsWithHeaders

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);
}
Also used : Response(com.artipie.http.Response) AsyncResponse(com.artipie.http.async.AsyncResponse) CompletableFuture(java.util.concurrent.CompletableFuture) RsWithStatus(com.artipie.http.rs.RsWithStatus) RsWithHeaders(com.artipie.http.rs.RsWithHeaders) AsyncResponse(com.artipie.http.async.AsyncResponse)

Aggregations

RsWithHeaders (com.artipie.http.rs.RsWithHeaders)2 RsWithStatus (com.artipie.http.rs.RsWithStatus)2 Headers (com.artipie.http.Headers)1 Response (com.artipie.http.Response)1 AsyncResponse (com.artipie.http.async.AsyncResponse)1 RsHasHeaders (com.artipie.http.hm.RsHasHeaders)1 RsHasStatus (com.artipie.http.hm.RsHasStatus)1 SliceHasResponse (com.artipie.http.hm.SliceHasResponse)1 RequestLine (com.artipie.http.rq.RequestLine)1 RsStatus (com.artipie.http.rs.RsStatus)1 SliceSimple (com.artipie.http.slice.SliceSimple)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 Test (org.junit.jupiter.api.Test)1