Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a possibility to customize HttpRequests sent by the API #47

Open
prismec opened this issue Feb 3, 2017 · 1 comment
Open

Provide a possibility to customize HttpRequests sent by the API #47

prismec opened this issue Feb 3, 2017 · 1 comment

Comments

@prismec
Copy link

prismec commented Feb 3, 2017

A usecase would be to configure the read and connect timeouts. Currently, the only possibility to do this is e.g.

new Client(new AccessTokenDispatcher(personalAccessToken) {
 @Override
 public HttpRequest buildRequest(String method, GenericUrl url, HttpContent content) throws IOException {
 HttpRequest request = httpTransport.createRequestFactory(req -> {
 req.setConnectTimeout(connectTimeout);
 req.setReadTimeout(readTimeout);
 }).buildRequest(method, url, content);
 request.getHeaders().setAuthorization("Bearer " + personalAccessToken);
 return request;
 }
});

This is problematic because I had to copy over code from the underlying AccessTokenDispatcher and Dispatcher classes.

There are already methods on the Client object taking a HttpTransport object, but due to the nature of the used Http libraries there's no way to construct a HttpTransport object with a HttpRequestInitializer since even the createRequestFactory methods are final.

I guess the easiest solution would be to provide a method on the Client object taking a HttpRequestIntializer.

┆Issue is synchronized with this Asana task

@prismec
Copy link
Author

prismec commented Feb 3, 2017

#48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant