gitlab4j / gitlab4j-api

GitLab4J API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories via the GitLab REST API
MIT License
1.06k stars 457 forks source link

Make HTTP client implementation configurable #778

Open t0m4uk1991 opened 2 years ago

t0m4uk1991 commented 2 years ago

The current implementation of GitLabApiClient does not provide a simple and easy way to configure/customize HTTP client.

So to fix this problem, we need to make the HTTP client pluggable.

To do this we need to:

  1. Make HTTP client implementation pluggable during GitLabApi creation
  2. Extract public contract of GitLabApiClient to separate interface.
  3. Provide interface implementation with other clients (at least okhttp)

Now we depend on implementation of javax.ws.rs.client.Client interface, so we can provide the implementation of this interface with OkHttp client (not sure here, maybe the better solution is to remove dependency on the Client interface and add a custom one)

@jabby Do we have any concerns about these changes?

jmini commented 4 months ago

This is probably similar to https://github.com/gitlab4j/gitlab4j-api/issues/924