package web_test import ( "testing" "git.akyoto.dev/go/assert" "git.akyoto.dev/go/web" ) func TestBytes(t *testing.T) { s := web.NewServer() s.Get("/", func(ctx web.Context) error { return ctx.Bytes([]byte("Hello")) }) response := s.Request("GET", "/", nil) assert.Equal(t, response.Status(), 200) assert.DeepEqual(t, response.Body(), []byte("Hello")) } func TestString(t *testing.T) { s := web.NewServer() s.Get("/", func(ctx web.Context) error { return ctx.String("Hello") }) response := s.Request("GET", "/", nil) assert.Equal(t, response.Status(), 200) assert.DeepEqual(t, response.Body(), []byte("Hello")) }