Skip to content

Commit

Permalink
bugfix: handle trailing slash in the request URL
Browse files Browse the repository at this point in the history
  • Loading branch information
avinassh committed Dec 9, 2023
1 parent cb5832f commit 04d18aa
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions libsql/internal/http/hranaV2/hranaV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/libsql/libsql-client-go/libsql/internal/hrana"
"github.com/libsql/libsql-client-go/libsql/internal/http/shared"
"io"
"net/http"
net_url "net/url"
"runtime/debug"
"strings"
"time"

"github.com/libsql/libsql-client-go/libsql/internal/hrana"
"github.com/libsql/libsql-client-go/libsql/internal/http/shared"
)

var commitHash string
Expand Down Expand Up @@ -182,7 +184,11 @@ func sendPipelineRequest(ctx context.Context, msg *hrana.PipelineRequest, url st
}
ctx, cancel := context.WithTimeout(ctx, 60*time.Second)
defer cancel()
req, err := http.NewRequestWithContext(ctx, "POST", url+"/v2/pipeline", bytes.NewReader(reqBody))
pipelineURL, err := net_url.JoinPath(url, "/v2/pipeline")
if err != nil {
return hrana.PipelineResponse{}, false, err
}
req, err := http.NewRequestWithContext(ctx, "POST", pipelineURL, bytes.NewReader(reqBody))
if err != nil {
return hrana.PipelineResponse{}, false, err
}
Expand Down

0 comments on commit 04d18aa

Please sign in to comment.