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 19aa18b commit 0033393Copy full SHA for 0033393
examples/math/math-kite/math.go
@@ -1,6 +1,7 @@
1
package main
2
3
import (
4
+ "context"
5
"flag"
6
"fmt"
7
@@ -20,7 +21,7 @@ func main() {
20
21
resp := "hello from pre handler!"
22
23
// let us return an hello to base square method!
- r.Context.Set("response", resp)
24
+ r.Context = context.WithValue(r.Context, "response", resp)
25
return resp, nil
26
})
27
@@ -30,7 +31,7 @@ func main() {
30
31
32
// Pass the response from the previous square method back to the
33
// client, this is imporant if you use post handler.
- return r.Context.Get("response")
34
+ return r.Context.Value("response").(string), nil
35
36
37
// Add our handler method, authentication is disabled for this example.
0 commit comments