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

feature request: Set http client #132

Open
dennypenta opened this issue Sep 4, 2024 · 1 comment
Open

feature request: Set http client #132

dennypenta opened this issue Sep 4, 2024 · 1 comment
Assignees
Labels
feature Cool stuff

Comments

@dennypenta
Copy link

What problem did you meet?

Injecting a http client as a dependency is necessary for observability and the others purposes.
For instance, in order to send a trace to OTLP trace provider we have to use our implementation of http.Client with custom http.Transport.

Describe what you'd like Logto to have

There are following options to achieve it:

func WithHttpClient(c *http.Client) func(*LogtoClient) {
  return func(logtoClient *LogtoClient) {
    logtoClient.httpClient = c
  }
}
  • Add a setter for http.Client, In my opinion it shouldn't be thread safe, the client must be instantiate on the dependencies build step
func (logtoClient *LogtoClient) SetHttpClient(c *http.Client) {
  logtoClient.httpClient = c
}
@xiaoyijun
Copy link
Collaborator

Hi @dennypenta , thanks for your feedback, I will take a look.

@xiaoyijun xiaoyijun self-assigned this Sep 18, 2024
@xiaoyijun xiaoyijun added the feature Cool stuff label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Cool stuff
Development

No branches or pull requests

2 participants