-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auth/jwt: Function names not intuitive. #526
Comments
I have no objection, but I'd ask that we also audit the other similar-sounding function names in other packages, to have a uniform style. |
We have the following similar functions in Tracing: ServerSide; pull data from header and push into Context: ClientSide; pull data from Context and propagate in headers: |
Sounds confusing to me too.
…On Thu, May 11, 2017 at 11:44 AM Bas van Beek ***@***.***> wrote:
We have the following similar functions in Tracing:
ServerSide; pull data from header and push into Context:
FromHTTPRequest and FromGRPCRequest
ClientSide; pull data from Context and propagate in headers:
ToHTTPRequest and ToGRPCRequest
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#526 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAD5ViXdTgJxmeCFf9DdbCFbj4-0xWiHks5r41clgaJpZM4NYQrw>
.
|
I agree the terminology in In tracing, you interpret the function names as "context to request" and "context from request", whereas in auth, you interpret it as "from http to context" and "to http from context".
Edit: I had the wrong context ;) in mind. |
|
I've been using the auth/jwt package on a project for a while now and I constantly trip over the difference between
FromHTTPContext
andToHTTPContext
. 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
->ContextToHTTP
ToHTTPContext
->HTTPToContext
Do others find the current names confusing also?
Does anyone have better suggestions that mine?
The text was updated successfully, but these errors were encountered: