Skip to content

Commit

Permalink
fix: Get request merge uri error
Browse files Browse the repository at this point in the history
  • Loading branch information
leeqvip committed Nov 1, 2021
1 parent 3e971c9 commit 19c6011
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion request.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ func (r *Request) Send() (*Response, error) {
switch r.payload.(type) {
case string:
params = r.payload.(string)
case []byte:
params = string(r.payload.([]byte))
case Params:
params = r.payload.(Params).Encode()
case url.Values:
Expand All @@ -64,7 +66,11 @@ func (r *Request) Send() (*Response, error) {
var request *http.Request
var err error
if r.method == GET {
request, err = http.NewRequest(r.method, r.uri+"?"+params, nil)
url := r.uri
if params != "" {
url = r.uri + "?" + params
}
request, err = http.NewRequest(r.method, url, nil)
} else {
request, err = http.NewRequest(r.method, r.uri, strings.NewReader(params))
}
Expand Down

0 comments on commit 19c6011

Please sign in to comment.