Skip to content

Commit

Permalink
Merge pull request #1320 from lesichkovm/patch-1
Browse files Browse the repository at this point in the history
Fix adding ? when no values passed
  • Loading branch information
dolmen authored Jul 11, 2023
2 parents 78aedbf + c029f41 commit af4d8a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion assert/http_assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, va
// empty string if building a new request fails.
func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string {
w := httptest.NewRecorder()
req, err := http.NewRequest(method, url+"?"+values.Encode(), nil)
if len(values) > 0 {
url += "?" + values.Encode()
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
return ""
}
Expand Down

0 comments on commit af4d8a6

Please sign in to comment.