Skip to content

Commit

Permalink
fix(proxy-sigv4-backend): revert to old body serialization to fix bug…
Browse files Browse the repository at this point in the history
… with body type (#17)

Signed-off-by: Alec Jacobs <[email protected]>
  • Loading branch information
alecjacobs5401 authored Sep 25, 2024
1 parent 797ab8d commit 3012ee4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugins/proxy-sigv4-backend/src/service/router.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('buildMiddleware', () => {
expiration: new Date('2024-05-05T20:30:00Z'),
});

// s
// starts the middleware and timer
await buildMiddleware({
logger,
routePath: '/foo',
Expand Down
7 changes: 3 additions & 4 deletions plugins/proxy-sigv4-backend/src/service/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,9 @@ export async function buildMiddleware(
headers: requestHeaders,
};

if (req.method !== 'GET' && req.method !== 'HEAD') {
request.body = req.is('application/json')
? JSON.stringify(req.body)
: req.body;
// TODO: support other content types with bodies
if (req.is('application/json') && req.method !== 'GET') {
request.body = JSON.stringify(req.body);
}

aws4.sign(request, credentials);
Expand Down

0 comments on commit 3012ee4

Please sign in to comment.