Skip to content

Commit 81ea957

Browse files
authored
chore: remove trailing slash from API base URL (#464)
The `packngo` SDK assumed that the base API URL did not end with a slash, but `equinix-sdk-go` assumes that it does (since it's generated from an OpenAPI spec, all API paths in `equinix-sdk-go` start with a slash). A trailing slash on the base API URL doesn't cause problems for `equinix-sdk-go`, but it can cause confusion when triaging issues. This removes the trailing slash from the 2 places where we are configuring the base API URL. We can do this safely now because we no longer use `packngo`. Alternatively, we could make the base API URL configuration optional; the API URL configured here is identical to [the default used by the `metalv1` package in `equinix-sdk-go`](https://github.com/equinix/equinix-sdk-go/blob/main/services/metalv1/configuration.go#L97), so we only really need to change the API URL for tests that use a mock API. That change would be more extensive so I opted for the smallest change instead.
2 parents b5eaed2 + e72ca03 commit 81ea957

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

cmd/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var (
4646
const (
4747
consumerToken = "Equinix Metal CLI"
4848
apiTokenEnvVar = "METAL_AUTH_TOKEN"
49-
apiURL = "https://api.equinix.com/metal/v1/"
49+
apiURL = "https://api.equinix.com/metal/v1"
5050
)
5151

5252
// NewCli struct

test/helper/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
const (
2121
ConsumerToken = ""
22-
URL = "https://api.equinix.com/metal/v1/"
22+
URL = "https://api.equinix.com/metal/v1"
2323
Version = "metal"
2424
)
2525

0 commit comments

Comments
 (0)