Skip to content

Instantly share code, notes, and snippets.

@aurimasbachanovicius
Created December 25, 2018 17:25
Show Gist options
  • Save aurimasbachanovicius/1ca583a2d433b7f5c7e19d83595c259b to your computer and use it in GitHub Desktop.
Save aurimasbachanovicius/1ca583a2d433b7f5c7e19d83595c259b to your computer and use it in GitHub Desktop.
golang simple response test
func simpleTestResponse(t *testing.T, want string, url string, method string) {
request, _ := http.NewRequest(method, url, nil)
response := httptest.NewRecorder()
PlayerServer(response, request)
got := response.Body.String()
if got != want {
t.Errorf("got '%s', want '%s'", got, want)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment