Skip to content

Commit

Permalink
go format
Browse files Browse the repository at this point in the history
  • Loading branch information
gohargasparyan authored and boyan-soubachov committed May 3, 2020
1 parent 2adb7b5 commit 9d083ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions assert/http_assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, va
func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values, body io.Reader) string {
w := httptest.NewRecorder()

if values !=nil {
url = url+"?"+values.Encode()
if values != nil {
url = url + "?" + values.Encode()
}
req, err := http.NewRequest(method, url, body)
if err != nil {
Expand All @@ -136,7 +136,7 @@ func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string,
if h, ok := t.(tHelper); ok {
h.Helper()
}
httpBody := HTTPBody(handler, method, url, values, body)
httpBody := HTTPBody(handler, method, url, values, body)

contains := strings.Contains(httpBody, fmt.Sprint(str))
if !contains {
Expand Down
12 changes: 6 additions & 6 deletions assert/http_assertions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ func TestHttpBodyWrappers(t *testing.T) {
assert := New(t)
mockAssert := New(new(testing.T))

assert.True(mockAssert.HTTPBodyContains(httpGetHelloNameHandler, "GET", "/", url.Values{"name": []string{"World"}}, nil,"Hello, World!"))
assert.True(mockAssert.HTTPBodyContains(httpGetHelloNameHandler, "GET", "/", url.Values{"name": []string{"World"}}, nil,"World"))
assert.False(mockAssert.HTTPBodyContains(httpGetHelloNameHandler, "GET", "/", url.Values{"name": []string{"World"}}, nil,"world"))
assert.True(mockAssert.HTTPBodyContains(httpGetHelloNameHandler, "GET", "/", url.Values{"name": []string{"World"}}, nil, "Hello, World!"))
assert.True(mockAssert.HTTPBodyContains(httpGetHelloNameHandler, "GET", "/", url.Values{"name": []string{"World"}}, nil, "World"))
assert.False(mockAssert.HTTPBodyContains(httpGetHelloNameHandler, "GET", "/", url.Values{"name": []string{"World"}}, nil, "world"))

assert.False(mockAssert.HTTPBodyNotContains(httpGetHelloNameHandler, "GET", "/", url.Values{"name": []string{"World"}}, nil, "Hello, World!"))
assert.False(mockAssert.HTTPBodyNotContains(httpGetHelloNameHandler, "GET", "/", url.Values{"name": []string{"World"}}, nil,"World"))
assert.True(mockAssert.HTTPBodyNotContains(httpGetHelloNameHandler, "GET", "/", url.Values{"name": []string{"World"}}, nil,"world"))
assert.False(mockAssert.HTTPBodyNotContains(httpGetHelloNameHandler, "GET", "/", url.Values{"name": []string{"World"}}, nil, "World"))
assert.True(mockAssert.HTTPBodyNotContains(httpGetHelloNameHandler, "GET", "/", url.Values{"name": []string{"World"}}, nil, "world"))
}

func httpGetHelloNameHandler(w http.ResponseWriter, r *http.Request) {
Expand All @@ -195,4 +195,4 @@ func httpPostHandler(w http.ResponseWriter, r *http.Request) {
}

w.Write(body)
}
}

0 comments on commit 9d083ca

Please sign in to comment.