function $57dcd834f0b70de5$var$fixRequestBody(proxyReq, req) {
    const requestBody = req.body;
    if (!requestBody || !Object.keys(requestBody).length) return;
    const contentType = proxyReq.getHeader('Content-Type');
    const writeBody = (bodyData)=>{
        // deepcode ignore ContentLengthInCode: bodyParser fix
        proxyReq.setHeader('Content-Length', Buffer.byteLength(bodyData));
        proxyReq.write(bodyData);
    };
    if (contentType && contentType.includes('application/json')) writeBody(JSON.stringify(requestBody));
    if (contentType === 'application/x-www-form-urlencoded') writeBody($68DQ8$querystring.stringify(requestBody));
}
/**
 * Fix proxied body if bodyParser is involved.
 */
Fix proxied body if bodyParser is involved.
Fix proxied body if bodyParser is involved .
function $57dcd834f0b70de5$var$fixRequestBody(proxyReq, req) {
    const requestBody = req.body;
    if (!requestBody || !Object.keys(requestBody).length) return;
    const contentType = proxyReq.getHeader('Content-Type');
    const writeBody = (bodyData)=>{
        proxyReq.setHeader('Content-Length', Buffer.byteLength(bodyData));
        proxyReq.write(bodyData);
    };
    if (contentType && contentType.includes('application/json')) writeBody(JSON.stringify(requestBody));
    if (contentType === 'application/x-www-form-urlencoded') writeBody($68DQ8$querystring.stringify(requestBody));
}
function $57dcd834f0b70de5$var$fixRequestBody ( proxyReq , req ) { const requestBody = req . body ; if ( ! requestBody || ! Object . keys ( requestBody ) . length ) return ; const contentType = proxyReq . getHeader ( 'Content-Type' ) ; const writeBody = ( bodyData ) => { proxyReq . setHeader ( 'Content-Length' , Buffer . byteLength ( bodyData ) ) ; proxyReq . write ( bodyData ) ; } ; if ( contentType && contentType . includes ( 'application/json' ) ) writeBody ( JSON . stringify ( requestBody ) ) ; if ( contentType === 'application/x-www-form-urlencoded' ) writeBody ( $68DQ8$querystring . stringify ( requestBody ) ) ; }
Fix proxied body if bodyParser is involved.
Fix proxied body if bodyParser is involved .
// deepcode ignore ContentLengthInCode: bodyParser fix