Skip to content

Commit

Permalink
fix: reordered fethOptions to allow overwriting headers as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Milfred committed Nov 8, 2024
1 parent 71adb9e commit 8193ff3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/runtime/server/api/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ export default defineEventHandler(async (event) => {
try {
const response = await $fetch.raw(target.toString(), {
method,
body,
...fetchOptions,

headers: {
headers: {
'content-type': reqHeaders['content-type'] || 'application/json',
cookie: reqHeaders.cookie,
'X-Api-Key': config.apiKey,
...(fetchOptions?.headers || {}),
},
...fetchOptions,
body,
});

for (const header of ['set-cookie', 'cache-control']) {
Expand Down

0 comments on commit 8193ff3

Please sign in to comment.