Java Code Examples for com.linecorp.armeria.common.HttpResponse#aggregate()
The following examples show how to use
com.linecorp.armeria.common.HttpResponse#aggregate() .
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: RetryingClientTest.java From armeria with Apache License 2.0 | 5 votes |
@Override public CompletionStage<RetryDecision> shouldRetry(ClientRequestContext ctx, @Nullable HttpResponse response, @Nullable Throwable cause) { final CompletableFuture<AggregatedHttpResponse> future = response.aggregate(); return future.handle((aggregatedResponse, unused) -> { if (aggregatedResponse != null && aggregatedResponse.contentUtf8().equalsIgnoreCase(retryContent)) { return decision; } return null; }); }
Example 2
Source File: HttpClientContextCaptorTest.java From armeria with Apache License 2.0 | 5 votes |
@Test void simple() { final WebClient client = WebClient.of(server.httpUri()); try (ClientRequestContextCaptor ctxCaptor = Clients.newContextCaptor()) { final HttpResponse res = client.get("/foo"); final ClientRequestContext ctx = ctxCaptor.get(); assertThat(ctx.path()).isEqualTo("/foo"); res.aggregate(); } }
Example 3
Source File: HttpClientContextCaptorTest.java From armeria with Apache License 2.0 | 5 votes |
@Test void connectionRefused() { try (ClientRequestContextCaptor ctxCaptor = Clients.newContextCaptor()) { final HttpResponse res = WebClient.of().get("http://127.0.0.1:1/foo"); final ClientRequestContext ctx = ctxCaptor.get(); assertThat(ctx.path()).isEqualTo("/foo"); res.aggregate(); } }
Example 4
Source File: HttpClientContextCaptorTest.java From armeria with Apache License 2.0 | 5 votes |
@Test void badPath() { try (ClientRequestContextCaptor ctxCaptor = Clients.newContextCaptor()) { // Send a request with a bad path. // Note: A colon cannot come in the first path component. final HttpResponse res = WebClient.of().get("http://127.0.0.1:1/:"); assertThatThrownBy(ctxCaptor::get).isInstanceOf(NoSuchElementException.class) .hasMessageContaining("no request was made"); res.aggregate(); } }