Created
February 22, 2018 13:17
-
-
Save crgimenes/27089081f0ef868e3d5f0d7bc0c07660 to your computer and use it in GitHub Desktop.
test httphandler example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestHTTPHandler(t *testing.T) { | |
w := httptest.NewRecorder() | |
expected := "{\n\t\"error\": \"test error\"\n}\n" | |
HTTPHandler(w, nil) | |
b := w.Body.Bytes() | |
if string(b) != expected { | |
t.Errorf("expected %q, want %q", expected, string(b)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment