We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 425dbef commit 203194bCopy full SHA for 203194b
README.md
@@ -21,6 +21,18 @@ api.Use(func(ctx *rest.Context) {
21
ctx.Set("authtoken", "roshangade")
22
})
23
24
+// hooks support on request pre-send or post-send
25
+// ctx.PreSend(func() error) OR ctx.PostSend(func() error)
26
+api.Use(func(ctx *rest.Context) {
27
+ s := time.Now().UnixNano()
28
+ ctx.PreSend(func() error {
29
+ x := time.Now().UnixNano() - s
30
+ ctx.SetHeader("x-runtime", strconv.FormatInt(x/int64(time.Millisecond), 10))
31
+ return nil
32
+ })
33
+})
34
+
35
36
// routes
37
api.Get("/", func(ctx *rest.Context) {
38
ctx.Text("Hello World!")
0 commit comments