Skip to content

Commit bdcf9d6

Browse files
committed
fix: disable analytics headers in browser to fix cors issues
this will hopefully be a temporary fix until we have a better solution
1 parent 8111263 commit bdcf9d6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/common.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import os = require('os');
44
const pkg = require('../package.json');
55

66
export function getSdkHeaders(serviceName: string, serviceVersion: string, operationId: string): any {
7+
// disable analytics headers in the browser - they cause cors issues
8+
const isBrowser = typeof window !== 'undefined';
9+
if (isBrowser) {
10+
return {};
11+
}
12+
713
const sdkName = 'watson-apis-node-sdk';
814
const sdkVersion = pkg.version;
915
const osName = os.platform();

0 commit comments

Comments
 (0)