MCPcopy
hub / github.com/AndrewWalsh/openapi-devtools / parseRequestBody

Function parseRequestBody

src/lib/store-helpers/create-leaf.ts:24–30  ·  view source on GitHub ↗
(harRequest: Entry)

Source from the content-addressed store, hash-verified

22};
23
24const parseRequestBody = (harRequest: Entry): JSONType => {
25 const { mimeType, text } = harRequest.request.postData || {};
26 if (mimeType?.startsWith(APPLICATION_JSON)) return parseJSON(text);
27 else if (mimeType?.startsWith(APPLICATION_X_WWW_FORM_URLENCODED) && text)
28 return qs.parse(text) as JSONType;
29 return null;
30};
31
32function createLeaf({ harRequest, responseBody, options }: Params): Leaf {
33 const { enableMoreInfo } = options;

Callers 1

createLeafFunction · 0.85

Calls 1

parseJSONFunction · 0.85

Tested by

no test coverage detected