Agreed with Axel.

http.Request will grow a Context() context.Context field, without breaking 
the existing http.Handler interface. Routers out there doing otherwise 
should come back around to using a common standard-lib interface.


On Friday, August 5, 2016 at 10:30:21 AM UTC-7, Axel Wagner wrote:
>
> net/http will start getting support for context in the coming week or so 
> (when go 1.7 comes out), so with "path" being ex tractable from the url 
> field of the request (and, if necessary, put into the context in a middle 
> ware) I don't really see the point of using a non-standard http package for 
> that…
>
> On Fri, Aug 5, 2016 at 4:52 PM, <kdy.19...@gmail.com <javascript:>> wrote:
>
>> Currently, if you want to change router package you use, all handlers and 
>> middlewares must be fixed.
>> So I propose a universal handler type with net/context and path parameter.
>>
>> Common requirements
>>
>>    - net/context 
>>    - path paramter
>>
>>
>> Example implementation
>> https://godoc.org/github.com/kdy1997/web
>> It's largely inspired by luci-go/server/router package. 
>> https://godoc.org/github.com/luci/luci-go/server/router
>>
>>
>> # Extensibility
>> This package provides extensibility by containing net/context. 
>>
>> Exmple usecase: 
>> luci-go uses net/context as dependency injector to help testing
>>
>> https://godoc.org/github.com/luci/luci-go/common/clock
>> https://godoc.org/github.com/luci/luci-go/common/data/rand/cryptorand
>> https://godoc.org/github.com/luci/luci-go/common/data/rand/mathrand
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to