You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
561 B

package main
import (
func TestYourHandler(t *testing.T) {
var r *http.Request
// We create a ResponseRecorder (which satisfies http.ResponseWriter) to record the response.
w := httptest.NewRecorder()
YourHandler(w, r)
actualResponseBody := w.Body.String()
expectedResponseBody := "this is not the endpoint you are looking for... try /metrics"
if actualResponseBody != expectedResponseBody {
t.Errorf("handler returned unexpected body: got %v want %v",
actualResponseBody, expectedResponseBody)