File tree Expand file tree Collapse file tree 2 files changed +29
-68
lines changed Expand file tree Collapse file tree 2 files changed +29
-68
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ description : Context Timeout middleware
3
+ ---
4
+
5
+ # Context Timeout
6
+
7
+ Timeout middleware is used to timeout request context within a predefined period so context aware methods could return
8
+ early.
9
+
10
+ ## Usage
11
+
12
+ ``` go
13
+ e.Use (middleware.ContextTimeout (60 * time.Second ))
14
+ ```
15
+
16
+ ## Custom Configuration
17
+
18
+ ``` go
19
+ e.Use (middleware.ContextTimeoutWithConfig (middleware.ContextTimeoutConfig {
20
+ // Skipper defines a function to skip middleware.
21
+ Skipper : nil ,
22
+ // ErrorHandler is a function when error aries in middleware execution.
23
+ ErrorHandler : nil ,
24
+ // Timeout configures a timeout for the middleware, defaults to 0 for no timeout
25
+ Timeout : 60 * time.Second ,
26
+ }))
27
+ ```
28
+
29
+
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments