Added streaming
This commit is contained in:
@ -52,6 +52,13 @@ func TestRouter(t *testing.T) {
|
||||
return ctx.File("testdata/file.txt")
|
||||
})
|
||||
|
||||
s.Get("/flush", func(ctx server.Context) error {
|
||||
ctx.Response().WriteString("Hello 1\n")
|
||||
ctx.Response().WriteString("Hello 2\n")
|
||||
ctx.Response().Flush()
|
||||
return nil
|
||||
})
|
||||
|
||||
s.Get("/echo", func(ctx server.Context) error {
|
||||
return ctx.Copy(ctx.Request())
|
||||
})
|
||||
@ -123,6 +130,7 @@ func TestRouter(t *testing.T) {
|
||||
{Method: "GET", URL: "/error", Body: "", Status: http.StatusUnauthorized, Response: "Not logged in"},
|
||||
{Method: "GET", URL: "/error2", Body: "", Status: http.StatusUnauthorized, Response: "Not logged in\nMissing auth token"},
|
||||
{Method: "GET", URL: "/file", Body: "", Status: http.StatusOK, Response: "Hello File"},
|
||||
{Method: "GET", URL: "/flush", Body: "", Status: http.StatusOK, Response: "Hello 1\nHello 2\n"},
|
||||
{Method: "GET", URL: "/not-found", Body: "", Status: http.StatusNotFound, Response: http.StatusText(http.StatusNotFound)},
|
||||
{Method: "GET", URL: "/request/data", Body: "", Status: http.StatusOK, Response: "GET HTTP/1.1 example.com /request/data"},
|
||||
{Method: "GET", URL: "/request/header", Body: "", Status: http.StatusOK, Response: ""},
|
||||
|
Reference in New Issue
Block a user