diff --git a/playground/vanilla/src/main.ts b/playground/vanilla/src/main.ts index 73445711..f1c12133 100644 --- a/playground/vanilla/src/main.ts +++ b/playground/vanilla/src/main.ts @@ -4,7 +4,10 @@ import './style.css' const headers = new Headers() headers.append('Awiwi', 'Awiwi') - +const headers2 = { + 'Awiwi': 'Awiwi' +} +console.log(headers2.constructor.name) // 2. Initialize the client with the preview token // from your space dashboard at https://app.storyblok.com const Storyblok = new StoryblokClient({ diff --git a/src/index.ts b/src/index.ts index 96d30496..496edac2 100755 --- a/src/index.ts +++ b/src/index.ts @@ -105,7 +105,7 @@ class Storyblok { headers.set('Accept', 'application/json') if (config.headers) { - const entries = config.headers.entries().toArray() + const entries = (config.headers.constructor.name === 'Headers') ? config.headers.entries().toArray() : Object.entries(config.headers) entries.forEach(([key, value]: [string, string]) => { headers.set(key, value)