1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-22 11:25:59 +00:00

Nothing special here, read HISTORY.md

This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-01-10 15:03:02 +02:00
parent 053588babd
commit e4ab993760
12 changed files with 109 additions and 137 deletions

View File

@@ -1,9 +1,11 @@
package iris_test
import (
"fmt"
"testing"
"github.com/kataras/iris"
"github.com/kataras/iris/httptest"
"testing"
)
// most tests lives inside context_test.go:Transactions, there lives the response writer's full and coblex tests
@@ -63,3 +65,35 @@ func TestResponseWriterToRecorderMiddleware(t *testing.T) {
e.GET("/").Expect().Status(iris.StatusForbidden).Body().Equal(beforeFlushBody)
}
func ExampleResponseWriter_WriteHeader() {
// func TestResponseWriterMultipleWriteHeader(t *testing.T) {
iris.ResetDefault()
iris.Default.Set(iris.OptionDisableBanner(true))
expectedOutput := "Hey"
iris.Get("/", func(ctx *iris.Context) {
// here
for i := 0; i < 10; i++ {
ctx.ResponseWriter.WriteHeader(iris.StatusOK)
}
ctx.Writef(expectedOutput)
// here
fmt.Println(expectedOutput)
// here
for i := 0; i < 10; i++ {
ctx.SetStatusCode(iris.StatusOK)
}
})
e := httptest.New(iris.Default, nil)
e.GET("/").Expect().Status(iris.StatusOK).Body().Equal(expectedOutput)
// here it shouldn't log an error that status code write multiple times (by the net/http package.)
// Output:
// Hey
}