You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect to get the path variable but instead I get nil after few times calling the endpoint.
For example if you call this endpoint few times (maybe around 20 times) then you will get nil instead of "25". But for the first few requests it works fine.
I noticed that for the first few time, the path values are not cached so everything is fine but for the rest of the calls, these values are coming from the cache and then id becomes nil.
The text was updated successfully, but these errors were encountered:
kamiiiel
changed the title
nil value for path variables
Getting nil value for path variables
Dec 3, 2019
I would expect to get the path variable but instead I get nil after few times calling the endpoint.
For example if you call this endpoint few times (maybe around 20 times) then you will get nil instead of "25". But for the first few requests it works fine.
package main
import (
"fmt"
"github.com/gramework/gramework"
)
func Hello(ctx *gramework.Context) {
ctx.Writef("Hello %s, id: %s!\n", ctx.UserValue("name"), ctx.UserValue("id"))
}
func main() {
app := gramework.New()
app.GET("/:id/:name", Hello)
app.ListenAndServe(":8080")
}
// Call the endpoint:
curl localhost:8080/25/Bob
I noticed that for the first few time, the path values are not cached so everything is fine but for the rest of the calls, these values are coming from the cache and then id becomes nil.
The text was updated successfully, but these errors were encountered: