Skip to content

Commit

Permalink
fix: pass headers in fetch, add user-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
dominique-pfister committed Jun 4, 2024
1 parent f7eb610 commit 21e922c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/helix-shared-bounce/src/bounce.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ export default function bounce(func, { responder, timeout = 500, debounce = () =
})();
// invoke the current function again, via HTTP, with the x-hlx-bounce-id
// header set, so that we don't get into an endless loop
request.headers.set('x-hlx-bounce-id', bounceId);
const signal = timeoutSignal(2 * timeout);
const actualResponse = (async () => {
try {
return await fetch(request.url, {
...request.init,
headers: request.headers,
headers: {
...request.headers,
'x-hlx-bounce-id': bounceId,
'user-agent': 'adobe/helix-shared-bounce',
},
signal,
});
} catch (e) {
Expand Down

0 comments on commit 21e922c

Please sign in to comment.