MCPcopy Create free account
hub / github.com/Effect-TS/effect / stripSearchAndHash

Function stripSearchAndHash

packages/effect/src/unstable/http/HttpMiddleware.ts:74–85  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

72const loggerDisabledRequests = new WeakSet<object>()
73
74const stripSearchAndHash = (url: string): string => {
75 const queryIndex = url.indexOf("?")
76 const hashIndex = url.indexOf("#")
77
78 if (queryIndex === -1) {
79 return hashIndex === -1 ? url : url.slice(0, hashIndex)
80 }
81 if (hashIndex === -1) {
82 return url.slice(0, queryIndex)
83 }
84 return url.slice(0, Math.min(queryIndex, hashIndex))
85}
86
87/**
88 * Runs an effect with HTTP response logging disabled for the current server request.

Callers 1

HttpMiddleware.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected