MCPcopy Create free account
hub / github.com/compozy/agh / normalizePort

Function normalizePort

internal/api/httpapi/middleware.go:187–201  ·  view source on GitHub ↗
(scheme string, port string)

Source from the content-addressed store, hash-verified

185}
186
187func normalizePort(scheme string, port string) string {
188 trimmed := strings.TrimSpace(port)
189 if trimmed != "" {
190 return trimmed
191 }
192
193 switch strings.ToLower(strings.TrimSpace(scheme)) {
194 case "http":
195 return "80"
196 case "https":
197 return "443"
198 default:
199 return ""
200 }
201}
202
203func firstNonEmptyString(values ...string) string {
204 for _, value := range values {

Callers 2

canonicalOriginFromURLFunction · 0.85
canonicalOriginFromHostFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected