MCPcopy Create free account
hub / github.com/zenstackhq/zenstack / makeNormalizedUrl

Method makeNormalizedUrl

packages/server/src/api/rest/index.ts:2226–2242  ·  view source on GitHub ↗
(path: string, query: Record<string, string | string[]> | undefined)

Source from the content-addressed store, hash-verified

2224 }
2225
2226 private makeNormalizedUrl(path: string, query: Record<string, string | string[]> | undefined) {
2227 const url = new URL(this.makeLinkUrl(path));
2228 for (const [key, value] of Object.entries(query ?? {})) {
2229 if (
2230 key.startsWith('filter[') ||
2231 key.startsWith('sort[') ||
2232 key === 'include' ||
2233 key.startsWith('include[') ||
2234 key.startsWith('fields[')
2235 ) {
2236 for (const v of enumerate(value)) {
2237 url.searchParams.append(key, v);
2238 }
2239 }
2240 }
2241 return url.toString();
2242 }
2243
2244 private getPagination(query: Record<string, string | string[]> | undefined) {
2245 if (!query) {

Callers 3

processFetchRelatedMethod · 0.95
processCollectionReadMethod · 0.95

Calls 3

makeLinkUrlMethod · 0.95
enumerateFunction · 0.90
toStringMethod · 0.45

Tested by

no test coverage detected