Skip to content

Commit

Permalink
Fix adding ? when no values passed
Browse files Browse the repository at this point in the history
  • Loading branch information
lesichkovm committed Dec 22, 2022
1 parent 9acc222 commit c029f41
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 c029f41

Please sign in to comment.