We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If someone uses more than one HTTP assertion with the same handler with the same args, eg:
assert.HTTPStatusCode(t, handler, "GET", "/path", nil, 200) assert.HTTPBodyContains(t, handler, "GET", "/path", nil, "hello")
Then this is not testing for state. A stateful handler could satisfy the tests independently but not in a single call.
A better implementation uses httptest from the standard library:
httptest
r := httptest.NewRequest("GET", "/path", nil) w := httptest.NewRecorder() handler(w, r) assert.Equal(t, w.Code, 200) assert.Contains(t, w.Body.String(), "hello")
This was discussed in stretchr/testify#925.
The HTTP assertions are:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
If someone uses more than one HTTP assertion with the same handler with the same args, eg:
Then this is not testing for state. A stateful handler could satisfy the tests independently but not in a single call.
A better implementation uses
httptest
from the standard library:This was discussed in stretchr/testify#925.
The HTTP assertions are:
The text was updated successfully, but these errors were encountered: