11
11
import org .asynchttpclient .AsyncCompletionHandler ;
12
12
import org .asynchttpclient .AsyncHttpClient ;
13
13
import org .asynchttpclient .DefaultAsyncHttpClient ;
14
+ import org .asynchttpclient .DefaultAsyncHttpClientConfig ;
14
15
import org .asynchttpclient .ListenableFuture ;
15
16
import org .asynchttpclient .Realm ;
16
17
import org .asynchttpclient .Request ;
102
103
*/
103
104
public class Zendesk implements Closeable {
104
105
private static final String JSON = "application/json; charset=UTF-8" ;
106
+ private static final DefaultAsyncHttpClientConfig DEFAULT_ASYNC_HTTP_CLIENT_CONFIG =
107
+ new DefaultAsyncHttpClientConfig .Builder ().setFollowRedirect (true ).build ();
105
108
private final boolean closeClient ;
106
109
private final AsyncHttpClient client ;
107
110
private final Realm realm ;
@@ -147,7 +150,7 @@ private Zendesk(AsyncHttpClient client, String url, String username, String pass
147
150
this .logger = LoggerFactory .getLogger (Zendesk .class );
148
151
this .closeClient = client == null ;
149
152
this .oauthToken = null ;
150
- this .client = client == null ? new DefaultAsyncHttpClient () : client ;
153
+ this .client = client == null ? new DefaultAsyncHttpClient (DEFAULT_ASYNC_HTTP_CLIENT_CONFIG ) : client ;
151
154
this .url = url .endsWith ("/" ) ? url + "api/v2" : url + "/api/v2" ;
152
155
if (username != null ) {
153
156
this .realm = new Realm .Builder (username , password )
@@ -169,7 +172,7 @@ private Zendesk(AsyncHttpClient client, String url, String oauthToken, Map<Strin
169
172
this .logger = LoggerFactory .getLogger (Zendesk .class );
170
173
this .closeClient = client == null ;
171
174
this .realm = null ;
172
- this .client = client == null ? new DefaultAsyncHttpClient () : client ;
175
+ this .client = client == null ? new DefaultAsyncHttpClient (DEFAULT_ASYNC_HTTP_CLIENT_CONFIG ) : client ;
173
176
this .url = url .endsWith ("/" ) ? url + "api/v2" : url + "/api/v2" ;
174
177
if (oauthToken != null ) {
175
178
this .oauthToken = oauthToken ;
0 commit comments