Implemented the io.Writer interface
This commit is contained in:
@ -26,6 +26,11 @@ func TestRouter(t *testing.T) {
|
||||
return ctx.String("Hello")
|
||||
})
|
||||
|
||||
s.Get("/write", func(ctx server.Context) error {
|
||||
_, err := io.WriteString(ctx, "Hello")
|
||||
return err
|
||||
})
|
||||
|
||||
s.Get("/error", func(ctx server.Context) error {
|
||||
return ctx.Status(http.StatusUnauthorized).Error("Not logged in")
|
||||
})
|
||||
@ -94,6 +99,7 @@ func TestRouter(t *testing.T) {
|
||||
{Method: "GET", URL: "/response/header", Status: http.StatusOK, Body: "text/plain"},
|
||||
{Method: "GET", URL: "/reader", Status: http.StatusOK, Body: "Hello"},
|
||||
{Method: "GET", URL: "/string", Status: http.StatusOK, Body: "Hello"},
|
||||
{Method: "GET", URL: "/write", Status: http.StatusOK, Body: "Hello"},
|
||||
{Method: "GET", URL: "/blog/testing-my-router", Status: http.StatusOK, Body: "testing-my-router"},
|
||||
{Method: "GET", URL: "/missing-parameter", Status: http.StatusOK, Body: ""},
|
||||
{Method: "POST", URL: "/", Status: http.StatusOK, Body: "Post"},
|
||||
|
Reference in New Issue
Block a user