MCPcopy Index your code
hub / github.com/simstudioai/sim / normalizeHost

Function normalizeHost

apps/sim/connectors/sentry/sentry.ts:132–141  ·  view source on GitHub ↗

* Normalizes the host config value: trims whitespace, strips any protocol prefix, * trailing slashes, and a pasted `/api` or `/api/0` suffix (the connector appends * `/api/0` itself), and falls back to sentry.io when empty. Genuine path prefixes * (e.g. `company.com/sentry` for subpath self-hoste

(rawHost: unknown)

Source from the content-addressed store, hash-verified

130 * (e.g. `company.com/sentry` for subpath self-hosted installs) are preserved.
131 */
132function normalizeHost(rawHost: unknown): string {
133 const host = typeof rawHost === 'string' ? rawHost.trim() : ''
134 if (!host) return DEFAULT_HOST
135 return host
136 .replace(/^https?:\/\//i, '')
137 .replace(/\/+$/, '')
138 .replace(/\/api(\/0)?$/i, '')
139 .replace(/\/+$/, '')
140 .trim()
141}
142
143/**
144 * Reads and normalizes the connector source configuration once per call.

Callers 1

readSourceConfigFunction · 0.70

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected