Skip to content

Commit f635eb8

Browse files
authored
fix signature error while the content includes @ (#646)
* fix signature error while the content includes @ * impore strings * add comment for this change in code * fix comments
1 parent 4c9ea21 commit f635eb8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

v2/client.go

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"net/http"
1212
"net/url"
1313
"os"
14+
"strings"
1415
"time"
1516

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

0 commit comments

Comments
 (0)