From adca5fb7cf1bb14b7c5fc486931d177dd9ac11e6 Mon Sep 17 00:00:00 2001 From: harshithad0703 Date: Thu, 6 Jun 2024 18:15:19 +0530 Subject: [PATCH] fix: fixed region issue setting region host when region is provided --- CHANGELOG.md | 4 ++++ package-lock.json | 4 ++-- package.json | 2 +- src/lib/contentstack.ts | 3 +-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85402d8..5f42f6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Change log +### Version: 4.0.3 +#### Date: June-11-2024 +Fixed region issue + ### Version: 4.0.2 #### Date: June-03-2024 Custom host implementation diff --git a/package-lock.json b/package-lock.json index b0b49f5..4cef94c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@contentstack/delivery-sdk", - "version": "4.0.1", + "version": "4.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@contentstack/delivery-sdk", - "version": "4.0.1", + "version": "4.0.3", "dependencies": { "@contentstack/core": "^1.0.1", "@contentstack/utils": "^1.3.3", diff --git a/package.json b/package.json index 7e84744..008a8ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@contentstack/delivery-sdk", - "version": "4.0.2", + "version": "4.0.3", "type": "commonjs", "main": "./dist/cjs/src/index.js", "types": "./dist/types/src/index.d.ts", diff --git a/src/lib/contentstack.ts b/src/lib/contentstack.ts index d69fb83..d01ecba 100644 --- a/src/lib/contentstack.ts +++ b/src/lib/contentstack.ts @@ -49,12 +49,11 @@ export function stack(config: StackConfig): StackClass { config.live_preview.host = config.host } } else { + defaultConfig.defaultHostname = config.host ? config.host : getHost(config.region, config.host); config.host = config.host || defaultConfig.defaultHostname; defaultConfig.live_preview = config.live_preview } - defaultConfig.defaultHostname = config.host ? config.host : getHost(config.region, config.host); - if (config.apiKey) { defaultConfig.headers.api_key = config.apiKey; } else {