Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func parseRequestURL(c *Client, r *Request) error {
buf := acquireBuffer()
defer releaseBuffer(buf)
// search for the next or first opened curly bracket
for curr := strings.Index(r.URL, "{"); curr == 0 || curr > prev; curr = prev + strings.Index(r.URL[prev:], "{") {
for curr := strings.Index(r.URL, "{"); curr == 0 || curr >= prev; curr = prev + strings.Index(r.URL[prev:], "{") {
// write everything from the previous position up to the current
if curr > prev {
buf.WriteString(r.URL[prev:curr])
Expand Down
5 changes: 3 additions & 2 deletions request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1827,10 +1827,11 @@ func TestGetPathParamAndPathParams(t *testing.T) {

c := dc().
SetBaseURL(ts.URL).
SetPathParam("userId", "sample@sample.com")
SetPathParam("userId", "sample@sample.com").
SetRawPathParam("details", "/details")

resp, err := c.R().SetPathParam("subAccountId", "100002").
Get("/v1/users/{userId}/{subAccountId}/details")
Get("/v1/users/{userId}/{subAccountId}{details}")

assertError(t, err)
assertEqual(t, http.StatusOK, resp.StatusCode())
Expand Down
Loading