Skip to content

Commit

Permalink
fix signature error while the content includes @ (#646)
Browse files Browse the repository at this point in the history
* fix signature error while the content includes @

* impore strings

* add comment for this change in code

* fix comments
  • Loading branch information
xyq-c-cpp authored Dec 13, 2024
1 parent 4c9ea21 commit f635eb8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions v2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"net/http"
"net/url"
"os"
"strings"
"time"

"github.com/bitly/go-simplejson"
Expand Down Expand Up @@ -440,8 +441,12 @@ func (c *Client) parseRequest(r *request, opts ...RequestOption) (err error) {
r.setParam(timestampKey, currentTimestamp()-c.TimeOffset)
}
queryString := r.query.Encode()
// @ is a safe character and does not require escape, So replace it back.
queryString = strings.ReplaceAll(queryString, "%40", "@")
body := &bytes.Buffer{}
bodyString := r.form.Encode()
// @ is a safe character and does not require escape, So replace it back.
bodyString = strings.ReplaceAll(bodyString, "%40", "@")
header := http.Header{}
if r.header != nil {
header = r.header.Clone()
Expand Down

0 comments on commit f635eb8

Please sign in to comment.