(t *testing.T)
| 130 | } |
| 131 | |
| 132 | func TestConfigurationYAML(t *testing.T) { |
| 133 | yamlFile, ferr := os.CreateTemp("", "configuration.yml") |
| 134 | |
| 135 | if ferr != nil { |
| 136 | t.Fatal(ferr) |
| 137 | } |
| 138 | |
| 139 | defer func() { |
| 140 | yamlFile.Close() |
| 141 | time.Sleep(50 * time.Millisecond) |
| 142 | os.Remove(yamlFile.Name()) |
| 143 | }() |
| 144 | |
| 145 | yamlConfigurationContents := ` |
| 146 | DisablePathCorrection: false |
| 147 | DisablePathCorrectionRedirection: true |
| 148 | EnablePathIntelligence: true |
| 149 | EnablePathEscape: false |
| 150 | FireMethodNotAllowed: true |
| 151 | EnableOptimizations: true |
| 152 | DisableBodyConsumptionOnUnmarshal: true |
| 153 | TimeFormat: "Mon, 02 Jan 2006 15:04:05 GMT" |
| 154 | Charset: "utf-8" |
| 155 | RemoteAddrHeaders: |
| 156 | - X-Real-Ip |
| 157 | - X-Forwarded-For |
| 158 | - CF-Connecting-IP |
| 159 | HostProxyHeaders: |
| 160 | X-Host: true |
| 161 | SSLProxyHeaders: |
| 162 | X-Forwarded-Proto: https |
| 163 | Other: |
| 164 | MyServerName: "Iris: https://github.com/kataras/iris" |
| 165 | ` |
| 166 | yamlFile.WriteString(yamlConfigurationContents) |
| 167 | filename := yamlFile.Name() |
| 168 | app := New().Configure(WithConfiguration(YAML(filename))) |
| 169 | |
| 170 | c := app.config |
| 171 | |
| 172 | if expected := false; c.DisablePathCorrection != expected { |
| 173 | t.Fatalf("error on TestConfigurationYAML: Expected DisablePathCorrection %v but got %v", expected, c.DisablePathCorrection) |
| 174 | } |
| 175 | |
| 176 | if expected := true; c.DisablePathCorrectionRedirection != expected { |
| 177 | t.Fatalf("error on TestConfigurationYAML: Expected DisablePathCorrectionRedirection %v but got %v", expected, c.DisablePathCorrectionRedirection) |
| 178 | } |
| 179 | |
| 180 | if expected := true; c.EnablePathIntelligence != expected { |
| 181 | t.Fatalf("error on TestConfigurationYAML: Expected EnablePathIntelligence %v but got %v", expected, c.EnablePathIntelligence) |
| 182 | } |
| 183 | |
| 184 | if expected := false; c.EnablePathEscape != expected { |
| 185 | t.Fatalf("error on TestConfigurationYAML: Expected EnablePathEscape %v but got %v", expected, c.EnablePathEscape) |
| 186 | } |
| 187 | |
| 188 | if expected := true; c.EnableOptimizations != expected { |
| 189 | t.Fatalf("error on TestConfigurationYAML: Expected EnableOptimizations %v but got %v", expected, c.EnablePathEscape) |
nothing calls this directly
no test coverage detected
searching dependent graphs…