Search in sources :

Example 6 with DefaultAsyncHttpClientConfig

use of org.asynchttpclient.DefaultAsyncHttpClientConfig in project async-http-client by AsyncHttpClient.

the class HttpUtilsTest method testDefaultFollowRedirect.

@Test
public void testDefaultFollowRedirect() {
    Request request = Dsl.get("http://stackoverflow.com/questions/1057564").setVirtualHost("example.com").build();
    DefaultAsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder().build();
    boolean followRedirect = HttpUtils.followRedirect(config, request);
    assertFalse(followRedirect, "Default value of redirect should be false");
}
Also used : Request(org.asynchttpclient.Request) DefaultAsyncHttpClientConfig(org.asynchttpclient.DefaultAsyncHttpClientConfig) Test(org.testng.annotations.Test)

Example 7 with DefaultAsyncHttpClientConfig

use of org.asynchttpclient.DefaultAsyncHttpClientConfig in project async-http-client by AsyncHttpClient.

the class HttpUtilsTest method testGetFollowRedirectPriorityGivenToRequest.

@Test
public void testGetFollowRedirectPriorityGivenToRequest() {
    Request request = Dsl.get("http://stackoverflow.com/questions/1057564").setFollowRedirect(false).build();
    DefaultAsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder().setFollowRedirect(true).build();
    boolean followRedirect = HttpUtils.followRedirect(config, request);
    assertFalse(followRedirect, "Follow redirect value set in request should be given priority");
}
Also used : Request(org.asynchttpclient.Request) DefaultAsyncHttpClientConfig(org.asynchttpclient.DefaultAsyncHttpClientConfig) Test(org.testng.annotations.Test)

Example 8 with DefaultAsyncHttpClientConfig

use of org.asynchttpclient.DefaultAsyncHttpClientConfig in project async-http-client by AsyncHttpClient.

the class HttpUtilsTest method testGetFollowRedirectInRequest.

@Test
public void testGetFollowRedirectInRequest() {
    Request request = Dsl.get("http://stackoverflow.com/questions/1057564").setFollowRedirect(true).build();
    DefaultAsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder().build();
    boolean followRedirect = HttpUtils.followRedirect(config, request);
    assertTrue(followRedirect, "Follow redirect must be true as set in the request");
}
Also used : Request(org.asynchttpclient.Request) DefaultAsyncHttpClientConfig(org.asynchttpclient.DefaultAsyncHttpClientConfig) Test(org.testng.annotations.Test)

Example 9 with DefaultAsyncHttpClientConfig

use of org.asynchttpclient.DefaultAsyncHttpClientConfig in project async-http-client by AsyncHttpClient.

the class HttpUtilsTest method testGetFollowRedirectInConfig.

@Test
public void testGetFollowRedirectInConfig() {
    Request request = Dsl.get("http://stackoverflow.com/questions/1057564").build();
    DefaultAsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder().setFollowRedirect(true).build();
    boolean followRedirect = HttpUtils.followRedirect(config, request);
    assertTrue(followRedirect, "Follow redirect should be equal to value specified in config when not specified in request");
}
Also used : Request(org.asynchttpclient.Request) DefaultAsyncHttpClientConfig(org.asynchttpclient.DefaultAsyncHttpClientConfig) Test(org.testng.annotations.Test)

Aggregations

DefaultAsyncHttpClientConfig (org.asynchttpclient.DefaultAsyncHttpClientConfig)9 Request (org.asynchttpclient.Request)4 Test (org.testng.annotations.Test)4 RouteBuilder (org.apache.camel.builder.RouteBuilder)3 CamelContext (org.apache.camel.CamelContext)2 ServiceBuilder (com.github.scribejava.core.builder.ServiceBuilder)1 OAuth2AccessToken (com.github.scribejava.core.model.OAuth2AccessToken)1 OAuthRequest (com.github.scribejava.core.model.OAuthRequest)1 Response (com.github.scribejava.core.model.Response)1 OAuth20Service (com.github.scribejava.core.oauth.OAuth20Service)1 AhcHttpClient (com.github.scribejava.httpclient.ahc.AhcHttpClient)1 Scanner (java.util.Scanner)1 JndiRegistry (org.apache.camel.impl.JndiRegistry)1 DefaultAsyncHttpClient (org.asynchttpclient.DefaultAsyncHttpClient)1