Skip to content

Commit 0033393

Browse files
committed
example: fix math kite
1 parent 19aa18b commit 0033393

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/math/math-kite/math.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"context"
45
"flag"
56
"fmt"
67

@@ -20,7 +21,7 @@ func main() {
2021
resp := "hello from pre handler!"
2122

2223
// let us return an hello to base square method!
23-
r.Context.Set("response", resp)
24+
r.Context = context.WithValue(r.Context, "response", resp)
2425
return resp, nil
2526
})
2627

@@ -30,7 +31,7 @@ func main() {
3031

3132
// Pass the response from the previous square method back to the
3233
// client, this is imporant if you use post handler.
33-
return r.Context.Get("response")
34+
return r.Context.Value("response").(string), nil
3435
})
3536

3637
// Add our handler method, authentication is disabled for this example.

0 commit comments

Comments
 (0)