Skip to content

Commit

Permalink
Since go 1.22 path variables are supported
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 committed Apr 5, 2024
1 parent f4685f5 commit a92e57c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gothic/gothic.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ func getProviderName(req *http.Request) (string, error) {
return p, nil
}

// since go-1.22 this is also supported
// see: https://go.dev/blog/routing-enhancements
if p := req.PathValue("provider"); p != "" {

Check failure on line 292 in gothic/gothic.go

View workflow job for this annotation

GitHub Actions / test (1.18.x, ubuntu-latest)

req.PathValue undefined (type *http.Request has no field or method PathValue)

Check failure on line 292 in gothic/gothic.go

View workflow job for this annotation

GitHub Actions / test (1.19.x, ubuntu-latest)

req.PathValue undefined (type *http.Request has no field or method PathValue)

Check failure on line 292 in gothic/gothic.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, ubuntu-latest)

req.PathValue undefined (type *http.Request has no field or method PathValue)

Check failure on line 292 in gothic/gothic.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, macos-latest)

req.PathValue undefined (type *http.Request has no field or method PathValue)

Check failure on line 292 in gothic/gothic.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

req.PathValue undefined (type *http.Request has no field or method PathValue)
return p, nil
}

// As a fallback, loop over the used providers, if we already have a valid session for any provider (ie. user has already begun authentication with a provider), then return that provider name
providers := goth.GetProviders()
session, _ := Store.Get(req, SessionName)
Expand Down

0 comments on commit a92e57c

Please sign in to comment.