From c3b4d3785196bd431d87daa6b462634ded637465 Mon Sep 17 00:00:00 2001 From: Sandros94 Date: Wed, 29 May 2024 00:38:18 +0200 Subject: [PATCH] fix(useSurrealFetch): header overwrite --- src/runtime/composables/surreal-fetch.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/runtime/composables/surreal-fetch.ts b/src/runtime/composables/surreal-fetch.ts index c6699e4..2408867 100644 --- a/src/runtime/composables/surreal-fetch.ts +++ b/src/runtime/composables/surreal-fetch.ts @@ -37,15 +37,14 @@ export function useSurrealFetch( if (token) { headers.Authorization = token } - opts.headers = Object.keys(headers).length - ? { - ...opts.headers, - ...headers, - } - : undefined return useFetch(endpoint, { ...opts, + headers: { + Accept: 'application/json', + ...opts.headers, + ...headers, + }, $fetch: useNuxtApp().$surrealFetch, }) }