Skip to content

fix(ws): support custom bootstrap HTTP client - #223

Open
Zhang-986 wants to merge 1 commit into
larksuite:v3_mainfrom
Zhang-986:codex/ws-bootstrap-http-client
Open

fix(ws): support custom bootstrap HTTP client#223
Zhang-986 wants to merge 1 commit into
larksuite:v3_mainfrom
Zhang-986:codex/ws-bootstrap-http-client

Conversation

@Zhang-986

Copy link
Copy Markdown

Fixes #201.

Problem:
The websocket client fetched its connection URL through a package-level HTTP client. In restricted network or proxy environments, callers could not route that bootstrap request through their own *http.Client without changing global state.

Root cause:
getConnURL called the package-level bootstrapHTTPClient directly instead of using client instance configuration.

Change:

  • Add WithHTTPClient(*http.Client) for the websocket client.
  • Store the bootstrap HTTP client on Client.
  • Keep the existing default behavior by initializing it from bootstrapHTTPClient.
  • Use the configured client when fetching the websocket connection URL.

Scope:
This PR only addresses the HTTP request used to fetch the websocket connection URL. It does not change the websocket dialer behavior.

Verification:

  • go test ./ws
  • go test ./...

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

Labels

None yet

Projects

None yet

1 participant