Skip to content

Commit

Permalink
Support parsing URI endpoint with path
Browse files Browse the repository at this point in the history
  • Loading branch information
atmask committed Feb 23, 2024
1 parent b5e88a0 commit 598ff85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/configgrpc/configgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ func (gcs *ClientConfig) EndpointPort() (string, error) {
if err != nil {
return "", err
}
port = strings.Split(port, "/")[0]
return port, nil
}

Expand Down
8 changes: 8 additions & 0 deletions config/configgrpc/configgrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ func TestGRPCClientEndpointPortParsing(t *testing.T) {
expectedPort: "1234",
errorExpected: false,
},
{
name: "test parsing port from endpoint with path",
config: ClientConfig {
Endpoint: "localhost:1234/path",
},
expectedPort: "1234",
errorExpected: false,
},
{
name: "test missing endpoint port",
config: ClientConfig {
Expand Down

0 comments on commit 598ff85

Please sign in to comment.