1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-21 11:57:02 +00:00

Add the new Go 1.8 Shutdown | Remove DisableBanner, is controlled by LoggerPolicy now.

Former-commit-id: 6ef71a4b9f5a79160a42d1111dd924e244ce1f4e
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-02-17 04:46:33 +02:00
parent 2a4997cadf
commit 21a18d0990
10 changed files with 77 additions and 2104 deletions

View File

@@ -29,12 +29,12 @@ func TestConfigurationStatic(t *testing.T) {
t.Fatalf("Configuration should be not equal, got: %#v", afterNew)
}
app = New(Configuration{DisableBanner: true})
app = New(Configuration{DisableBodyConsumptionOnUnmarshal: true})
afterNew = *app.Config
if app.Config.DisableBanner == false {
t.Fatalf("Passing a Configuration field as Option fails, expected DisableBanner to be true but was false")
if app.Config.DisableBodyConsumptionOnUnmarshal == false {
t.Fatalf("Passing a Configuration field as Option fails, expected DisableBodyConsumptionOnUnmarshal to be true but was false")
}
app = New() // empty , means defaults so
@@ -47,21 +47,21 @@ func TestConfigurationOptions(t *testing.T) {
charset := "MYCHARSET"
disableBanner := true
app := New(OptionCharset(charset), OptionDisableBanner(disableBanner))
app := New(OptionCharset(charset), OptionDisableBodyConsumptionOnUnmarshal(disableBanner))
if got := app.Config.Charset; got != charset {
t.Fatalf("Expected configuration Charset to be: %s but got: %s", charset, got)
}
if got := app.Config.DisableBanner; got != disableBanner {
t.Fatalf("Expected configuration DisableBanner to be: %#v but got: %#v", disableBanner, got)
if got := app.Config.DisableBodyConsumptionOnUnmarshal; got != disableBanner {
t.Fatalf("Expected configuration DisableBodyConsumptionOnUnmarshal to be: %#v but got: %#v", disableBanner, got)
}
// now check if other default values are setted (should be setted automatically)
expected := DefaultConfiguration()
expected.Charset = charset
expected.DisableBanner = disableBanner
expected.DisableBodyConsumptionOnUnmarshal = disableBanner
has := *app.Config
if !reflect.DeepEqual(has, expected) {
@@ -74,11 +74,11 @@ func TestConfigurationOptionsDeep(t *testing.T) {
disableBanner := true
vhost := "mydomain.com"
// first charset,disableBanner and profilepath, no canonical order.
app := New(OptionCharset(charset), OptionDisableBanner(disableBanner), OptionVHost(vhost))
app := New(OptionCharset(charset), OptionDisableBodyConsumptionOnUnmarshal(disableBanner), OptionVHost(vhost))
expected := DefaultConfiguration()
expected.Charset = charset
expected.DisableBanner = disableBanner
expected.DisableBodyConsumptionOnUnmarshal = disableBanner
expected.VHost = vhost
has := *app.Config
@@ -112,7 +112,7 @@ func TestConfigurationYAML(t *testing.T) {
DisablePathCorrection: false
EnablePathEscape: false
FireMethodNotAllowed: true
DisableBanner: true
DisableBodyConsumptionOnUnmarshal: true
DisableBodyConsumptionOnUnmarshal: true
TimeFormat: Mon, 01 Jan 2006 15:04:05 GMT
Charset: UTF-8
@@ -161,8 +161,8 @@ func TestConfigurationYAML(t *testing.T) {
t.Fatalf("error on TestConfigurationYAML: Expected FireMethodNotAllowed %v but got %v", expected, c.FireMethodNotAllowed)
}
if expected := true; c.DisableBanner != expected {
t.Fatalf("error on TestConfigurationYAML: Expected DisableBanner %v but got %v", expected, c.DisableBanner)
if expected := true; c.DisableBodyConsumptionOnUnmarshal != expected {
t.Fatalf("error on TestConfigurationYAML: Expected DisableBodyConsumptionOnUnmarshal %v but got %v", expected, c.DisableBodyConsumptionOnUnmarshal)
}
if expected := true; c.DisableBodyConsumptionOnUnmarshal != expected {