This update affects only testers who used iris.Tester at the past.
FIX: httptest flags caused by httpexpect which used to help you with tests inside old funciris.Tester as reported here
NEW: iris.ResetDefault() func which resets the default iris instance which is the station for the most part of the public/package API
NEW: package httptest with configuration which can be passed per 'tester' instead of iris instance( this is very helpful for testers)
CHANGED: All tests are now converted for 'white-box' testing, means that tests now have package named: iris_test instead of iris in the same main directory.
CHANGED: iris.Tester moved to httptest.New which lives inside the new/kataras/iris/httptest package, so:
import (
"github.com/kataras/iris/httptest"
"github.com/kataras/iris"
"testing"
)
func MyTest(t *testing.T) {
// make sure that you reset your default station if you don't use the form of app := iris.New()
iris.ResetDefault()
iris.Get("/mypath", func(ctx *iris.Context){
ctx.Write("my body")
})
e:= httptest.New(iris.Default, t)
// with configs: e:= httptest.New(iris.Default, t, httptest.ExplicitURL(true), httptest.Debug(true))
e.GET("/mypath").Expect().Status(iris.StatusOK).Body().Equal("my body")
}
Finally, some plugins container's additions:
NEW: iris.Plugins.Len() func which returns the length of the current activated plugins in the default station
NEW: iris.Plugins.Fired("event") int func which returns how much times and from how many plugins a particular event type is fired, event types are: "prelookup", "prebuild", "prelisten", "postlisten", "preclose", "predownload"
NEW: iris.Plugins.PreLookupFired() bool func which returns true if PreLookup fired at least one time
NEW: iris.Plugins.PreBuildFired() bool func which returns true if PreBuild fired at least one time
NEW: iris.Plugins.PreListenFired() bool func which returns true ifPreListen/PreListenParallel fired at least one time
NEW: iris.Plugins.PostListenFired() bool func which returns true if PostListen fired at least one time
NEW: iris.Plugins.PreCloseFired() bool func which returns true if PreClose fired at least one time
NEW: iris.Plugins.PreDownloadFired() bool func which returns true if PreDownload fired at least one time
Go 语言极速 web 框架 IRIS V4.6.0 发布
Go 语言极速 web 框架 IRIS V4.1.1 发布了,更新如下:
4.5.2/.3 -> 4.6.0
This update affects only testers who used iris.Tester at the past.
FIX: httptest flags caused by httpexpect which used to help you with tests inside old funciris.Tester as reported here
NEW: iris.ResetDefault() func which resets the default iris instance which is the station for the most part of the public/package API
NEW: package httptest with configuration which can be passed per 'tester' instead of iris instance( this is very helpful for testers)
CHANGED: All tests are now converted for 'white-box' testing, means that tests now have package named: iris_test instead of iris in the same main directory.
CHANGED: iris.Tester moved to httptest.New which lives inside the new/kataras/iris/httptest package, so:
import ( "github.com/kataras/iris" "testing" ) func MyTest(t *testing.T) { iris.Get("/mypath", func(ctx *iris.Context){ ctx.Write("my body") }) // with configs: iris.Config.Tester.ExplicitURL/Debug = true e:= iris.Tester(t) e.GET("/mypath").Expect().Status(iris.StatusOK).Body().Equal("my body") }used that instead/new
import ( "github.com/kataras/iris/httptest" "github.com/kataras/iris" "testing" ) func MyTest(t *testing.T) { // make sure that you reset your default station if you don't use the form of app := iris.New() iris.ResetDefault() iris.Get("/mypath", func(ctx *iris.Context){ ctx.Write("my body") }) e:= httptest.New(iris.Default, t) // with configs: e:= httptest.New(iris.Default, t, httptest.ExplicitURL(true), httptest.Debug(true)) e.GET("/mypath").Expect().Status(iris.StatusOK).Body().Equal("my body") }Finally, some plugins container's additions:
NEW: iris.Plugins.Len() func which returns the length of the current activated plugins in the default station
NEW: iris.Plugins.Fired("event") int func which returns how much times and from how many plugins a particular event type is fired, event types are: "prelookup", "prebuild", "prelisten", "postlisten", "preclose", "predownload"
NEW: iris.Plugins.PreLookupFired() bool func which returns true if PreLookup fired at least one time
NEW: iris.Plugins.PreBuildFired() bool func which returns true if PreBuild fired at least one time
NEW: iris.Plugins.PreListenFired() bool func which returns true ifPreListen/PreListenParallel fired at least one time
NEW: iris.Plugins.PostListenFired() bool func which returns true if PostListen fired at least one time
NEW: iris.Plugins.PreCloseFired() bool func which returns true if PreClose fired at least one time
NEW: iris.Plugins.PreDownloadFired() bool func which returns true if PreDownload fired at least one time
Golang目前已经发展成为非常广泛使用的开发语言,如果你开发WEB、后台服务、API,都可以用到golang。
原先我们用go来开发基于web的应用时,一般会用到net/http包,然后在代码中处理大量相同的事情,如:路由、鉴权等。
现在通过Iris-Go,可以方便的帮助你来开发基于web的应用。