MCPcopy Index your code
hub / github.com/github/github-mcp-server / BuildResourceMetadataURL

Function BuildResourceMetadataURL

pkg/http/oauth/oauth.go:249–263  ·  view source on GitHub ↗

BuildResourceMetadataURL constructs the full URL to the OAuth protected resource metadata endpoint.

(r *http.Request, cfg *Config, resourcePath string)

Source from the content-addressed store, hash-verified

247
248// BuildResourceMetadataURL constructs the full URL to the OAuth protected resource metadata endpoint.
249func BuildResourceMetadataURL(r *http.Request, cfg *Config, resourcePath string) string {
250 host, scheme := GetEffectiveHostAndScheme(r, cfg)
251 suffix := ""
252 if resourcePath != "" && resourcePath != "/" {
253 if !strings.HasPrefix(resourcePath, "/") {
254 suffix = "/" + resourcePath
255 } else {
256 suffix = resourcePath
257 }
258 }
259 if cfg != nil && cfg.BaseURL != "" {
260 return strings.TrimSuffix(cfg.BaseURL, "/") + OAuthProtectedResourcePrefix + suffix
261 }
262 return fmt.Sprintf("%s://%s%s%s", scheme, host, OAuthProtectedResourcePrefix, suffix)
263}
264
265func normalizeBasePath(path string) string {
266 trimmed := strings.TrimSpace(path)

Callers 3

WithScopeChallengeFunction · 0.92
sendAuthChallengeFunction · 0.92

Calls 1

Tested by 1