Skip to content

Commit 1b61a41

Browse files
committed
Remove leading slash when composing URL paths
1 parent 15a582b commit 1b61a41

26 files changed

+36
-28
lines changed

bearer.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ type bearer struct {
99
rt http.RoundTripper
1010
}
1111

12+
// HeaderKey is "Unstructured-API-Key", which is the header where Unstructured expects to find the API key.
13+
const HeaderKey = "Unstructured-API-Key"
14+
1215
// RoundTrip implements the http.RoundTripper interface.
1316
func (b *bearer) RoundTrip(req *http.Request) (*http.Response, error) {
14-
req.Header.Set("Unstructured-API-Key", b.key)
17+
req.Header.Set(HeaderKey, b.key)
1518

1619
// This is implementing the http.RoundTripper interface, errors should be passed through as-is
1720
return b.rt.RoundTrip(req) //nolint:wrapcheck

destination_connection_check.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
func (c *Client) CreateDestinationConnectionCheck(ctx context.Context, id string) (*DagNodeConnectionCheck, error) {
1212
req, err := http.NewRequestWithContext(ctx,
1313
http.MethodPost,
14-
c.endpoint.JoinPath("/destinations", id, "connection-check").String(),
14+
c.endpoint.JoinPath("destinations", id, "connection-check").String(),
1515
nil,
1616
)
1717
if err != nil {
@@ -31,7 +31,7 @@ func (c *Client) CreateDestinationConnectionCheck(ctx context.Context, id string
3131
func (c *Client) GetDestinationConnectionCheck(ctx context.Context, id string) (*DagNodeConnectionCheck, error) {
3232
req, err := http.NewRequestWithContext(ctx,
3333
http.MethodGet,
34-
c.endpoint.JoinPath("/destinations", id, "connection-check").String(),
34+
c.endpoint.JoinPath("destinations", id, "connection-check").String(),
3535
nil,
3636
)
3737
if err != nil {

destination_create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (c *Client) CreateDestination(ctx context.Context, in CreateDestinationRequ
3333

3434
req, err := http.NewRequestWithContext(ctx,
3535
http.MethodPost,
36-
c.endpoint.JoinPath("/destinations/").String(),
36+
c.endpoint.JoinPath("destinations/").String(),
3737
bytes.NewReader(body),
3838
)
3939
if err != nil {

destination_delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
func (c *Client) DeleteDestination(ctx context.Context, id string) error {
1111
req, err := http.NewRequestWithContext(ctx,
1212
http.MethodDelete,
13-
c.endpoint.JoinPath("/destinations", id).String(),
13+
c.endpoint.JoinPath("destinations", id).String(),
1414
nil,
1515
)
1616
if err != nil {

destination_get.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
func (c *Client) GetDestination(ctx context.Context, id string) (*Destination, error) {
1111
req, err := http.NewRequestWithContext(ctx,
1212
http.MethodGet,
13-
c.endpoint.JoinPath("/destinations", id).String(),
13+
c.endpoint.JoinPath("destinations", id).String(),
1414
nil,
1515
)
1616
if err != nil {

destination_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
func (c *Client) ListDestinations(ctx context.Context, typ string) ([]Destination, error) {
1111
req, err := http.NewRequestWithContext(ctx,
1212
http.MethodGet,
13-
c.endpoint.JoinPath("/destinations").String(),
13+
c.endpoint.JoinPath("destinations").String(),
1414
nil,
1515
)
1616
if err != nil {

destination_update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (c *Client) UpdateDestination(ctx context.Context, in UpdateDestinationRequ
3535

3636
req, err := http.NewRequestWithContext(ctx,
3737
http.MethodPut,
38-
c.endpoint.JoinPath("/destinations", in.ID).String(),
38+
c.endpoint.JoinPath("destinations", in.ID).String(),
3939
bytes.NewReader(body),
4040
)
4141
if err != nil {

job_cancel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
func (c *Client) CancelJob(ctx context.Context, id string) error {
1111
req, err := http.NewRequestWithContext(ctx,
1212
http.MethodPost,
13-
c.endpoint.JoinPath("/jobs", id, "cancel").String(),
13+
c.endpoint.JoinPath("jobs", id, "cancel").String(),
1414
nil,
1515
)
1616
if err != nil {

job_details.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
func (c *Client) GetJobDetails(ctx context.Context, id string) (*JobDetails, error) {
1212
req, err := http.NewRequestWithContext(ctx,
1313
http.MethodGet,
14-
c.endpoint.JoinPath("/jobs", id, "details").String(),
14+
c.endpoint.JoinPath("jobs", id, "details").String(),
1515
nil,
1616
)
1717
if err != nil {

job_download.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type DownloadJobRequest struct {
1818
func (c *Client) DownloadJob(ctx context.Context, in DownloadJobRequest) (io.ReadCloser, error) {
1919
req, err := http.NewRequestWithContext(ctx,
2020
http.MethodGet,
21-
c.endpoint.JoinPath("/jobs", in.JobID, "download").String(),
21+
c.endpoint.JoinPath("jobs", in.JobID, "download").String(),
2222
nil,
2323
)
2424
if err != nil {

0 commit comments

Comments
 (0)