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

Enable setting OkHttpClient for FirebaseFunctions #5430

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

svenjacobs
Copy link

This PR fixes #5404. I deliberately did not add the OkHttpClient instance to the getInstance factory methods because this would mean four additional variants of getInstance. I believe setting the HTTP client instance is a rare use case, so this is solved through an additional setter.

@svenjacobs
Copy link
Author

svenjacobs commented Oct 17, 2023

I forgot to add nullable annotations. I will add them later. Done.

@svenjacobs svenjacobs force-pushed the functions-okhttpclient branch from 5ecb107 to 7ff13c5 Compare December 8, 2024 14:06
@svenjacobs
Copy link
Author

The PR has been rebased onto the Kotlin migration of main.

@svenjacobs
Copy link
Author

@thatfiredev Some explanation:

I created the setOkHttpClient and getOkHttpClient functions in Kotlin although I didn't have to. I could have just opened the variable client. However from the naming it might not be obvious what client is. There are three possibilities now.

  1. Leave the setter and getter functions as is
  2. Remove the functions and make client public accessible
public var client: OkHttpClient

Additionally we could add more descriptive names via annotations here. But these would only be visible from Java.

public var client: OkHttpClient = OkHttpClient()
  @JvmName("setOkHttpClient")
  set
  @JvmName("getOkHttpClient")
  get
  1. Remove the functions, rename client to okHttpClient and make it public accessible. We would have a descriptive name for both Kotlin and Java.

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Functions: Allow setting OkHttpClient instance
2 participants