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

Function encodeReservedAware

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

Source from the content-addressed store, hash-verified

48const RESERVED_UNENCODED_RE = /[A-Za-z0-9\-._~:/?#[\]@!$&'()*+,;=]/;
49
50const encodeReservedAware = (raw: string, allowReserved: boolean): string => {
51 if (!allowReserved) return encodeURIComponent(raw);
52 // Walk char-by-char so the reserved set passes through as-is.
53 let out = "";
54 for (const ch of raw) {
55 out += RESERVED_UNENCODED_RE.test(ch) ? ch : encodeURIComponent(ch);
56 }
57 return out;
58};
59
60const queryParamValues = (value: unknown, param: OperationParameter): string[] => {
61 if (value === undefined || value === null) return [];

Callers 2

invoke.tsFile · 0.85
encodeFormValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected