@usagetap/sdk 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -125,7 +125,7 @@ var IDEMPOTENCY_HEADER = "idempotency-key";
|
|
|
125
125
|
var SDK_HEADER = "x-usage-sdk";
|
|
126
126
|
var USER_AGENT = "UsageTapClient";
|
|
127
127
|
var CANONICAL_MEDIA_TYPE = "application/vnd.usagetap.v1+json";
|
|
128
|
-
var SDK_VERSION = "0.
|
|
128
|
+
var SDK_VERSION = "0.4.0" ;
|
|
129
129
|
var HAS_WINDOW = typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined";
|
|
130
130
|
var UsageTapClient = class {
|
|
131
131
|
apiKey;
|
|
@@ -497,10 +497,12 @@ var UsageTapClient = class {
|
|
|
497
497
|
const headers = {
|
|
498
498
|
...this.defaultHeaders,
|
|
499
499
|
[SDK_HEADER]: `js/${SDK_VERSION}`,
|
|
500
|
-
"user-agent": `${USER_AGENT}/${SDK_VERSION}`,
|
|
501
500
|
"content-type": "application/json",
|
|
502
501
|
accept: CANONICAL_MEDIA_TYPE
|
|
503
502
|
};
|
|
503
|
+
if (!HAS_WINDOW) {
|
|
504
|
+
headers["user-agent"] = `${USER_AGENT}/${SDK_VERSION}`;
|
|
505
|
+
}
|
|
504
506
|
if (this.authHeader === API_KEY_HEADER) {
|
|
505
507
|
headers[API_KEY_HEADER] = this.apiKey;
|
|
506
508
|
} else {
|