Skip to content

auth/jwt: Function names not intuitive. #526

@ChrisHines

Description

@ChrisHines

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions