Skip to content

Commit 70c0f36

Browse files
committed
fix: ignore empty string when setting endpoint
1 parent 0deb045 commit 70c0f36

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hcloud/client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ type ClientOption func(*Client)
124124
// WithEndpoint configures a Client to use the specified API endpoint.
125125
func WithEndpoint(endpoint string) ClientOption {
126126
return func(client *Client) {
127-
client.endpoint = strings.TrimRight(endpoint, "/")
127+
if endpoint != "" {
128+
client.endpoint = strings.TrimRight(endpoint, "/")
129+
}
128130
}
129131
}
130132

0 commit comments

Comments
 (0)