1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 09:57:01 +00:00

add http timeout example

This commit is contained in:
Gerasimos (Makis) Maropoulos
2022-01-04 23:06:39 +02:00
parent 611e981f3a
commit d8dde0b958
4 changed files with 66 additions and 2 deletions

View File

@@ -209,10 +209,12 @@ func WithKeepAlive(keepAliveDur time.Duration) Configurator {
}
// WithTimeout sets the `Configuration.Timeout` field to the given duration.
func WithTimeout(timeoutDur time.Duration, htmlBody string) Configurator {
func WithTimeout(timeoutDur time.Duration, htmlBody ...string) Configurator {
return func(app *Application) {
app.config.Timeout = timeoutDur
app.config.TimeoutMessage = htmlBody
if len(htmlBody) > 0 {
app.config.TimeoutMessage = htmlBody[0]
}
}
}