MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / processRequestBody

Function processRequestBody

frontend/packages/common/src/hooks/http.ts:115–125  ·  view source on GitHub ↗
(options: EoRequest, headers: EoHeaders, shouldTransformKeys: boolean)

Source from the content-addressed store, hash-verified

113}
114
115const processRequestBody = (options: EoRequest, headers: EoHeaders, shouldTransformKeys: boolean) => {
116 let newBody: { [k: string]: unknown } | undefined
117 if (shouldTransformKeys && isJsonHttp(headers) && options.eoBody) {
118 newBody = keysToSnake(options.eoBody, options.eoTransformKeys as string[]) as { [k: string]: unknown }
119 }
120
121 if (isJsonHttp(headers) && (newBody || options.eoBody)) {
122 options.body = JSON.stringify(trimStringValuesInObject(newBody || options.eoBody))
123 }
124 return options.body
125}
126
127const DEFAULT_HEADERS = {
128 'Content-Type': 'application/json',

Callers 1

fetchDataFunction · 0.85

Calls 3

isJsonHttpFunction · 0.85
keysToSnakeFunction · 0.85
trimStringValuesInObjectFunction · 0.85

Tested by

no test coverage detected