MCPcopy
hub / github.com/github/github-mcp-server / buildResourceURL

Method buildResourceURL

pkg/http/oauth/oauth.go:198–211  ·  view source on GitHub ↗

buildResourceURL constructs the full resource URL for OAuth metadata.

(r *http.Request, resourcePath string)

Source from the content-addressed store, hash-verified

196
197// buildResourceURL constructs the full resource URL for OAuth metadata.
198func (h *AuthHandler) buildResourceURL(r *http.Request, resourcePath string) string {
199 host, scheme := GetEffectiveHostAndScheme(r, h.cfg)
200 baseURL := fmt.Sprintf("%s://%s", scheme, host)
201 if h.cfg.BaseURL != "" {
202 baseURL = strings.TrimSuffix(h.cfg.BaseURL, "/")
203 }
204 if resourcePath == "" {
205 resourcePath = "/"
206 }
207 if !strings.HasPrefix(resourcePath, "/") {
208 resourcePath = "/" + resourcePath
209 }
210 return baseURL + resourcePath
211}
212
213// GetEffectiveHostAndScheme returns the effective host and scheme for a request.
214//

Callers 1

metadataHandlerMethod · 0.95

Calls 1

Tested by

no test coverage detected