Skip to content
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

Adding get provider name support for chi router #569

Merged
merged 1 commit into from
Jul 14, 2024

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
15 checks passed
@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 :)

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.

2 participants