MCPcopy
hub / github.com/danielgtaylor/huma / getSchemaHost

Function getSchemaHost

transforms.go:238–255  ·  view source on GitHub ↗
(ctx Context)

Source from the content-addressed store, hash-verified

236}
237
238func getSchemaHost(ctx Context) string {
239 if host := ctx.Header("X-Forwarded-Host"); host != "" {
240 return host
241 }
242
243 if fwd := ctx.Header("Forwarded"); fwd != "" {
244 for part := range strings.SplitSeq(fwd, ",") {
245 for directive := range strings.SplitSeq(part, ";") {
246 directive = strings.TrimSpace(directive)
247 if strings.HasPrefix(strings.ToLower(directive), "host=") {
248 return strings.Trim(directive[5:], "\"")
249 }
250 }
251 }
252 }
253
254 return ctx.Host()
255}

Callers 1

TransformMethod · 0.85

Calls 2

HeaderMethod · 0.65
HostMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…