MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / encodeReservedAware

Function encodeReservedAware

packages/plugins/openapi/src/sdk/invoke.ts:55–63  ·  view source on GitHub ↗
(raw: string, allowReserved: boolean)

Source from the content-addressed store, hash-verified

53const RESERVED_UNENCODED_RE = /[A-Za-z0-9\-._~:/?#[\]@!$&'()*+,;=]/;
54
55const encodeReservedAware = (raw: string, allowReserved: boolean): string => {
56 if (!allowReserved) return encodeURIComponent(raw);
57 // Walk char-by-char so the reserved set passes through as-is.
58 let out = "";
59 for (const ch of raw) {
60 out += RESERVED_UNENCODED_RE.test(ch) ? ch : encodeURIComponent(ch);
61 }
62 return out;
63};
64
65type QueryParamEntry = readonly [name: string, value: string];
66

Callers 2

invoke.tsFile · 0.85
encodeFormValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected