Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
arithmetic1728 committed Sep 15, 2021
1 parent 752b460 commit 808e10f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public static ClientContext create(StubSettings settings) throws IOException {
if (transportChannelProvider.needsHeaders()) {
transportChannelProvider = transportChannelProvider.withHeaders(headers);
}
if (!hasApiKey && transportChannelProvider.needsCredentials() && credentials != null) {
if (!hasApiKey && transportChannelProvider.needsCredentials()) {
transportChannelProvider = transportChannelProvider.withCredentials(credentials);
}
String endpoint =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public TransportChannelProvider withPoolSize(int size) {

@Override
public TransportChannel getTransportChannel() throws IOException {
if (needsCredentials()) {
if (needsCredentials() && !headers.containsKey("x-goog-api-key")) {
throw new IllegalStateException("Needs Credentials");
}
transport.setExecutor(executor);
Expand All @@ -192,7 +192,7 @@ public String getTransportName() {

@Override
public boolean needsCredentials() {
return credentials == null && !headers.containsKey("x-goog-api-key");
return credentials == null;
}

@Override
Expand Down

0 comments on commit 808e10f

Please sign in to comment.