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

Details of 'http : HttpClient' object is visible to the public through Ballerina api-docs #504

Closed
NipunaDilhara opened this issue Jan 31, 2020 · 2 comments · Fixed by ballerina-platform/module-ballerina-http#994
Assignees
Labels
module/http Points/3 Team/PCM Protocol connector packages related issues Type/Improvement

Comments

@NipunaDilhara
Copy link

Description:
The 'http: HttpClient' object details (which should be private) can still be seen in the ballerina api-docs [1].

[1] https://ballerina.io/learn/api-docs/ballerina/http/clients/HttpClient.html

@chamil321 chamil321 transferred this issue from ballerina-platform/ballerina-lang Oct 29, 2020
@anupama-pathirage anupama-pathirage added the Team/PCM Protocol connector packages related issues label Mar 1, 2021
@chamil321
Copy link
Contributor

chamil321 commented Mar 27, 2021

Possible solution:

Public client classes
  http:Client
  http:LoadBalanceClient
  http:FailoverClient


Internal Client classes
  HttpClient - which is native client connector
  HttpSecureClient
  RetryClient
  RedirectClient
  HttpCachingClient
  CircuitBreakerClient
  CookieClient

All these internal clients are structurally equal. So whatever we do, should be done to all of them. When trying to make the private, it blocks at CircuitBreakerClient level. because CircuitBreakerClient some additional APIs also. Eg: forceClose(), forceOpen().

So as a solution, we can make CircuitBreakerClient a public client and hide all other clients.

Public client classes
 http:Client
 http:LoadBalanceClient
 http:FailoverClient
 http:CircuitBreakerClient

This API change is not backward compatible and can affect the users

@chamil321
Copy link
Contributor

Possible solution:

Public client classes
  http:Client
  http:LoadBalanceClient
  http:FailoverClient


Internal Client classes
  HttpClient - which is native client connector
  HttpSecureClient
  RetryClient
  RedirectClient
  HttpCachingClient
  CircuitBreakerClient
  CookieClient

All these internal clients are structurally equal. So whatever we do, should be done to all of them. When trying to make the private, it blocks at CircuitBreakerClient level. because CircuitBreakerClient some additional APIs also. Eg: forceClose(), forceOpen().

So as a solution, we can make CircuitBreakerClient a public client and hide all other clients.

Public client classes
 http:Client
 http:LoadBalanceClient
 http:FailoverClient
 http:CircuitBreakerClient

This API change is not backward compatible and can affect the users

When checking the implementation, it was found that http:HttpClient was visible for circuit breaker to execute 3 methods.

  1. forceClose()
  2. forceOpen()
  3. getCurrentState()

So moved them to http:Client and hide all the subtypes of http:Client via ballerina-platform/module-ballerina-http#994

Hence only the following clients will be public

Public client classes
 http:Client
 http:LoadBalanceClient
 http:FailoverClient

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/http Points/3 Team/PCM Protocol connector packages related issues Type/Improvement
Projects
None yet
3 participants