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

Function normalizeGitLabHost

apps/sim/tools/gitlab/utils.ts:48–58  ·  view source on GitHub ↗
(rawHost: unknown)

Source from the content-addressed store, hash-verified

46 * @throws {UnsafeGitLabHostError} when a non-empty host is structurally unsafe.
47 */
48export function normalizeGitLabHost(rawHost: unknown): string {
49 const raw = typeof rawHost === 'string' ? rawHost.trim() : ''
50 if (!raw) return DEFAULT_GITLAB_HOST
51 const host = raw
52 .replace(/^https?:\/\//i, '')
53 .replace(/\/+$/, '')
54 .trim()
55 if (!host) return DEFAULT_GITLAB_HOST
56 assertSafeGitLabHostString(host, String(rawHost))
57 return host
58}
59
60/**
61 * Builds the REST API v4 base URL for the configured host. Defaults to

Callers 3

utils.test.tsFile · 0.90
normalizeHostFunction · 0.90
getGitLabApiBaseFunction · 0.85

Calls 2

replaceMethod · 0.65

Tested by

no test coverage detected