MCPcopy Create free account
hub / github.com/avoidwork/tenso / formParser

Function formParser

tests/unit/middleware-parse.test.js:123–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121 mockReq.headers["content-type"] = "application/x-www-form-urlencoded";
122 mockReq.body = "key=value&foo=bar";
123 const formParser = body => {
124 const result = {};
125 body.split("&").forEach(pair => {
126 const [key, value] = pair.split("=");
127 result[key] = value;
128 });
129
130 return result;
131 };
132 mockReq.server.parsers.set("application/x-www-form-urlencoded", formParser);
133
134 parse(mockReq, mockRes, mockNext);

Callers 4

benchmarkFormParserFunction · 0.85
testParserMemoryUsageFunction · 0.85
testParserMemoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected