Skip to content

Commit

Permalink
setting body to "" in GET request
Browse files Browse the repository at this point in the history
  • Loading branch information
cgawron committed Mar 27, 2024
1 parent 9426e0f commit 04897ac
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ app.use(logResponseBody);
app.use(`${PREFIX}*`,
proxy(API_URL, {
https: true,
parseBody: false,
parseBody: true,
proxyReqPathResolver: function (req) {
const path = req.baseUrl.replace(PREFIX, '/v1');
logger.debug('path: ', req.baseUrl, path);
Expand All @@ -262,6 +262,10 @@ app.use(`${PREFIX}*`,
},
proxyReqBodyDecorator: function (bodyContent, srcReq) {
logger.debug('bodyContent', bodyContent, srcReq.body, srcReq.headers);
if (!srcReq.body || srcReq.method === 'GET') {
logger.debug('no body content in GET request')
return "";
}
return bodyContent;
}
})
Expand Down

0 comments on commit 04897ac

Please sign in to comment.