MCPcopy Create free account
hub / github.com/kataras/iris / TestFromStd

Function TestFromStd

core/handlerconv/from_std_test.go:15–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestFromStd(t *testing.T) {
16 expected := "ok"
17 std := func(w http.ResponseWriter, r *http.Request) {
18 _, err := w.Write([]byte(expected))
19 if err != nil {
20 t.Fatal(err)
21 }
22 }
23
24 h := handlerconv.FromStd(http.HandlerFunc(std))
25
26 hFunc := handlerconv.FromStd(std)
27
28 app := iris.New()
29 app.Get("/handler", h)
30 app.Get("/func", hFunc)
31
32 e := httptest.New(t, app)
33
34 e.GET("/handler").
35 Expect().Status(iris.StatusOK).Body().IsEqual(expected)
36
37 e.GET("/func").
38 Expect().Status(iris.StatusOK).Body().IsEqual(expected)
39}
40
41func TestFromStdWithNext(t *testing.T) {
42 basicauth := "secret"

Callers

nothing calls this directly

Calls 8

FromStdFunction · 0.92
NewFunction · 0.92
FatalMethod · 0.80
NewMethod · 0.80
StatusMethod · 0.80
GetMethod · 0.65
BodyMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…