rcrowley / go-tigertonic

A Go framework for building JSON web services inspired by Dropwizard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

We need a way to factor out per-request initialization

rcrowley opened this issue · comments

@wadey says:

main thing I miss is a way to build up state as the request passes along the filters, not sure what the best way to model that is though
i dont like how some frameworks just make a grabbag map on the request object
but I feel like there is something we could do, maybe a domain specific request object you can create
I want to noodle on that, thats the main thing I feel like tigertonic is missing

It's pretty dissatisfying to have to call a GetUser(request) function in every single http.Handler that needs a *User, for example.

Method values may give us something but we've used those so far to provide global, not per-request, context.

@wadey How's this attempt strike you?

I'm not 100% happy with it, but I can't think of anything better so I think this is the best option for now.

@wadey as you start to use this stuff, please open bugs for whatever annoys you.