@@ -8,12 +8,12 @@ import getUserAgent from './core/Util.js'
88import contentstackClient from './contentstackClient.js'
99import httpClient from './core/contentstackHTTPClient.js'
1010const regionHostMap = {
11- 'NA' : 'api.contentstack.io' ,
12- 'EU' : 'eu-api.contentstack.com' ,
13- ' AZURE_NA' : 'azure-na-api.contentstack.com' ,
14- ' AZURE_EU' : 'azure-eu-api.contentstack.com' ,
15- ' GCP_NA' : 'gcp-na-api.contentstack.com' ,
16- ' GCP_EU' : 'gcp-eu-api.contentstack.com'
11+ NA : 'api.contentstack.io' ,
12+ EU : 'eu-api.contentstack.com' ,
13+ AZURE_NA : 'azure-na-api.contentstack.com' ,
14+ AZURE_EU : 'azure-eu-api.contentstack.com' ,
15+ GCP_NA : 'gcp-na-api.contentstack.com' ,
16+ GCP_EU : 'gcp-eu-api.contentstack.com'
1717}
1818
1919/**
@@ -169,24 +169,23 @@ const regionHostMap = {
169169 * @returns Contentstack.Client
170170 */
171171export function client ( params = { } ) {
172-
173172 let defaultHostName
174173
175- if ( params . region ) {
176- const region = params . region . toUpperCase ( )
177- if ( ! regionHostMap [ region ] ) {
178- throw new Error ( `Invalid region '${ params . region } ' provided. Allowed regions are: ${ Object . keys ( regionHostMap ) . join ( ', ' ) } ` )
179- }
180- defaultHostName = regionHostMap [ region ]
181- } else if ( params . host ) {
174+ if ( params . region ) {
175+ const region = params . region . toUpperCase ( )
176+ if ( ! regionHostMap [ region ] ) {
177+ throw new Error ( `Invalid region '${ params . region } ' provided. Allowed regions are: ${ Object . keys ( regionHostMap ) . join ( ', ' ) } ` )
178+ }
179+ defaultHostName = regionHostMap [ region ]
180+ } else if ( params . host ) {
182181 defaultHostName = params . host
183- } else {
182+ } else {
184183 defaultHostName = regionHostMap [ 'NA' ]
185- }
184+ }
186185
187- const defaultParameter = {
188- defaultHostName : defaultHostName
189- }
186+ const defaultParameter = {
187+ defaultHostName : defaultHostName
188+ }
190189
191190 const sdkAgent = `contentstack-management-javascript/${ packages . version } `
192191 const userAgentHeader = getUserAgent ( sdkAgent ,
0 commit comments