Skip to content

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

@prismec

Description

@prismec

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions