From 2b3544d8bd2eeed1955ea09f52987350efe2fd11 Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar Date: Wed, 8 Nov 2023 17:05:09 +0530 Subject: [PATCH] feat: :sparkles: introduces early access headers in stack config --- index.d.ts | 1 + src/core/stack.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/index.d.ts b/index.d.ts index 464ef2b6..eb4ca7fc 100644 --- a/index.d.ts +++ b/index.d.ts @@ -55,6 +55,7 @@ export interface Config { live_preview?: LivePreview; plugins?: ContentstackPlugin[]; fetchOptions?: FetchOptions; + ea_headers?: string[] } // Stack Config export interface StackConfig { diff --git a/src/core/stack.js b/src/core/stack.js index 89076bd6..d25e2bf2 100755 --- a/src/core/stack.js +++ b/src/core/stack.js @@ -101,6 +101,9 @@ export default class Stack { if (typeof stack_arguments[0].branch === "string" && stack_arguments[0].branch !== undefined) { this.headers.branch = stack_arguments[0].branch } + if (typeof stack_arguments[0].ea_headers == "object" && Array.isArray(stack_arguments[0].ea_headers) && stack_arguments[0].ea_headers.length > 0) { + this.headers['x-header-ea'] = stack_arguments[0].ea_headers.join(',') + } this.environment = stack_arguments[0].environment; return this; } else {