ggicci/httpin

r.Context().Value(httpin.Input) always nil

thielpeter opened this issue · 2 comments

Hey, I think Im using httpin right but r.Context().Value(httpin.Input) is always nil.

This is my setup:

Query: /api/cases?is_member=true&sort_by[]=age&sort_desc[]=false
Router: rApi.HandleFunc("/cases", handlers.PostCases).Methods("GET")
Handler: fmt.Printf("form: %#v\n",r.Context().Value(httpin.Input))

Im using mux. Is there something I have missed to configure? Do I have to use httpin.UseGorillaMux("path", mux.Vars)?

Ok as shown in the example (https://github.com/ggicci/httpin-example/blob/main/main.go) it is necessary to inject httpin.NewInput(*inputObject) in the router handle. Would be nice to mention this in the documentation for example in the "Getting Started" section

Thanks for the advice @thielpeter. I've updated the Getting Started section.