Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Shubham Sharma <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
  • Loading branch information
elena-kolevska and shubham1172 authored Dec 5, 2023
1 parent 2a7fa82 commit 16ccf46
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/implementation/Client/DaprClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default class DaprClient {
this.options = {
daprHost: options.daprHost,
daprPort: options.daprPort,
communicationProtocol: options.communicationProtocol ?? Settings.getDefaultCommunicationProtocol(),
communicationProtocol: this.daprClient.options.communicationProtocol,
isKeepAlive: options.isKeepAlive,
logger: options.logger,
actor: options.actor,
Expand Down
16 changes: 8 additions & 8 deletions src/implementation/Client/GRPCClient/GRPCClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ export default class GRPCClient implements IClient {
}

private generateEndpoint(options: Partial<DaprClientOptions>): GrpcEndpoint {
let host = Settings.getDefaultHost();
let port = Settings.getDefaultPort(communicationProtocolEnum.GRPC);
let host = options?.daprHost ?? Settings.getDefaultHost();

Check failure on line 82 in src/implementation/Client/GRPCClient/GRPCClient.ts

View workflow job for this annotation

GitHub Actions / test-e2e

'host' is never reassigned. Use 'const' instead

Check failure on line 82 in src/implementation/Client/GRPCClient/GRPCClient.ts

View workflow job for this annotation

GitHub Actions / build (16.14.0)

'host' is never reassigned. Use 'const' instead
let port = options?.daprPort ?? Settings.getDefaultGrpcPort();

Check failure on line 83 in src/implementation/Client/GRPCClient/GRPCClient.ts

View workflow job for this annotation

GitHub Actions / test-e2e

'port' is never reassigned. Use 'const' instead

Check failure on line 83 in src/implementation/Client/GRPCClient/GRPCClient.ts

View workflow job for this annotation

GitHub Actions / build (16.14.0)

'port' is never reassigned. Use 'const' instead
let uri = `${host}:${port}`;

if (options?.daprHost || options?.daprPort) {
host = options?.daprHost ?? Settings.getDefaultHost();
port = options?.daprPort ?? Settings.getDefaultPort(communicationProtocolEnum.GRPC);
uri = `${host}:${port}`;
} else if (Settings.getDefaultGrpcEndpoint() != "") {
uri = Settings.getDefaultGrpcEndpoint();
if (!(options?.daprHost || options?.daprPort)) {
// If neither host nor port are specified, check the endpoint environment variable.
let endpoint = Settings.getDefaultGrpcEndpoint();

Check failure on line 88 in src/implementation/Client/GRPCClient/GRPCClient.ts

View workflow job for this annotation

GitHub Actions / test-e2e

'endpoint' is never reassigned. Use 'const' instead

Check failure on line 88 in src/implementation/Client/GRPCClient/GRPCClient.ts

View workflow job for this annotation

GitHub Actions / build (16.14.0)

'endpoint' is never reassigned. Use 'const' instead
if (endpoint != "") {
uri = endpoint;
}
}

return new GrpcEndpoint(uri);
Expand Down
4 changes: 2 additions & 2 deletions src/network/HttpEndpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ export class HttpEndpoint extends Endpoint {
// if they are not specified so that the URL class can parse it
private preprocessUri(url: string) {
if (url.startsWith(":")) {
url = URIParseConfig.DEFAULT_SCHEME_HTTP + "://" + URIParseConfig.DEFAULT_HOSTNAME + url;
return URIParseConfig.DEFAULT_SCHEME_HTTP + "://" + URIParseConfig.DEFAULT_HOSTNAME + url;
}
if (!url.includes("://")) {
url = URIParseConfig.DEFAULT_SCHEME_HTTP + "://" + url;
return URIParseConfig.DEFAULT_SCHEME_HTTP + "://" + url;
}
return url;
}
Expand Down

0 comments on commit 16ccf46

Please sign in to comment.