MCPcopy Index your code
hub / github.com/kataras/iris / TestHandlerUsingNetHTTP

Function TestHandlerUsingNetHTTP

_examples/testing/httptest/main_test.go:33–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31}
32
33func TestHandlerUsingNetHTTP(t *testing.T) {
34 handler := func(ctx iris.Context) {
35 ctx.WriteString("Hello, World!")
36 }
37
38 // A shortcut for net/http/httptest.NewRecorder/NewRequest.
39 w := httptest.NewRecorder()
40 r := httptest.NewRequest("GET", "/", nil)
41
42 httptest.Do(w, r, handler)
43 if expected, got := "Hello, World!", w.Body.String(); expected != got {
44 t.Fatalf("expected body: %s but got: %s", expected, got)
45 }
46}

Callers

nothing calls this directly

Calls 4

DoFunction · 0.92
WriteStringMethod · 0.80
FatalfMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…