I've been using the auth/jwt package on a project for a while now and I constantly trip over the difference between FromHTTPContext and ToHTTPContext. The structure of the names don't help me remember which way the data is flowing.
From godoc:
func FromHTTPContext() http.RequestFunc
FromHTTPContext moves JWT token from context to request header. Particularly useful for clients.
func ToHTTPContext() http.RequestFunc
ToHTTPContext moves JWT token from request header to context. Particularly useful for servers.
I'd prefer the following renaming of these functions (and the corresponding gRPC pair):
FromHTTPContext -> ContextToHTTP
ToHTTPContext -> HTTPToContext
Do others find the current names confusing also?
Does anyone have better suggestions that mine?
I've been using the auth/jwt package on a project for a while now and I constantly trip over the difference between
FromHTTPContextandToHTTPContext. The structure of the names don't help me remember which way the data is flowing.From godoc:
FromHTTPContext moves JWT token from context to request header. Particularly useful for clients.
ToHTTPContext moves JWT token from request header to context. Particularly useful for servers.
I'd prefer the following renaming of these functions (and the corresponding gRPC pair):
FromHTTPContext->ContextToHTTPToHTTPContext->HTTPToContextDo others find the current names confusing also?
Does anyone have better suggestions that mine?