Skip to content

Conversation

@fardinabir
Copy link
Contributor

Chi, one of the fastest and most lightweight routers for Go. When it is used for routing requests to a Gothic handler like below, Gothic fails to get the value of the 'provider' parameter.

func signUpRouter() *chi.Mux {
	r := chi.NewRouter()
	r.Get("/{provider}", gothic.BeginAuthHandler)
	return r
}

The way to get the parameter value from a Chi request is chi.URLParam(r, paramName). However, inside the getProviderName function of Gothic, there is no support for this extraction method.

By merging this PR, it will no longer be necessary to set the provider explicitly in the context of the request to get Gothic working with the Chi router.

@techknowlogick techknowlogick merged commit 5d0f51e into markbates:master Jul 14, 2024
@techknowlogick
Copy link
Collaborator

Thanks!!! I use chi myself and have just been using a work around until now. This'll hopefully let me refactor that code away :)

@lrstanley
Copy link
Contributor

I don't understand why this was merged. Is there a reason goth wants to require everyone pull in chi even if they don't use it? There are no other routing libraries pulled in, so why chi? This doesn't make sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants