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

fix: Apiary Host returns user set host if set #2455

Merged
merged 4 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,11 @@ public String getResolvedHost(String serviceName) {
*/
@InternalApi
public String getResolvedApiaryHost(String serviceName) {
// The host value set to DEFAULT_HOST if the user didn't configure a host. If the
// user set a host the library uses that value, otherwise, construct the host for the user.
Copy link
Member

@suztomo suztomo Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These specification (how it should behave) should be in Javadoc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the javadoc shouldn't start with "Temporarily used for ...". It starts with "Returns ..."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

if (!DEFAULT_HOST.equals(host)) {
return host;
}
String resolvedUniverseDomain =
universeDomain != null ? universeDomain : Credentials.GOOGLE_DEFAULT_UNIVERSE;
return "https://" + serviceName + "." + resolvedUniverseDomain + "/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,10 +566,10 @@ public void testGetResolvedApiaryHost_customUniverseDomain_customHost() {
TestServiceOptions options =
TestServiceOptions.newBuilder()
.setUniverseDomain("test.com")
.setHost("https://service.random.com")
.setHost("https://service.random.com/")
.setProjectId("project-id")
.build();
assertThat(options.getResolvedApiaryHost("service")).isEqualTo("https://service.test.com/");
assertThat(options.getResolvedApiaryHost("service")).isEqualTo("https://service.random.com/");
}

// No User Configuration = GDU, Default Credentials = GDU
Expand Down
Loading