MCPcopy Create free account
hub / github.com/chimurai/http-proxy-middleware / parsePathRewriteRules

Function parsePathRewriteRules

src/path-rewriter.ts:67–81  ·  view source on GitHub ↗
(rewriteConfig: PathRewriteConfig | undefined)

Source from the content-addressed store, hash-verified

65}
66
67function parsePathRewriteRules(rewriteConfig: PathRewriteConfig | undefined) {
68 const rules: RewriteRule[] = [];
69
70 if (isPlainObject(rewriteConfig)) {
71 for (const [key, value] of Object.entries(rewriteConfig)) {
72 rules.push({
73 regex: new RegExp(key),
74 value: value,
75 });
76 debug('rewrite rule created: "%s" ~> "%s"', key, value);
77 }
78 }
79
80 return rules;
81}

Callers 1

createPathRewriterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected