@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.cjs
CHANGED
|
@@ -127,7 +127,7 @@ var IDEMPOTENCY_HEADER = "idempotency-key";
|
|
|
127
127
|
var SDK_HEADER = "x-usage-sdk";
|
|
128
128
|
var USER_AGENT = "UsageTapClient";
|
|
129
129
|
var CANONICAL_MEDIA_TYPE = "application/vnd.usagetap.v1+json";
|
|
130
|
-
var SDK_VERSION = "0.
|
|
130
|
+
var SDK_VERSION = "0.4.0" ;
|
|
131
131
|
var HAS_WINDOW = typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined";
|
|
132
132
|
var UsageTapClient = class {
|
|
133
133
|
apiKey;
|
|
@@ -499,10 +499,12 @@ var UsageTapClient = class {
|
|
|
499
499
|
const headers = {
|
|
500
500
|
...this.defaultHeaders,
|
|
501
501
|
[SDK_HEADER]: `js/${SDK_VERSION}`,
|
|
502
|
-
"user-agent": `${USER_AGENT}/${SDK_VERSION}`,
|
|
503
502
|
"content-type": "application/json",
|
|
504
503
|
accept: CANONICAL_MEDIA_TYPE
|
|
505
504
|
};
|
|
505
|
+
if (!HAS_WINDOW) {
|
|
506
|
+
headers["user-agent"] = `${USER_AGENT}/${SDK_VERSION}`;
|
|
507
|
+
}
|
|
506
508
|
if (this.authHeader === API_KEY_HEADER) {
|
|
507
509
|
headers[API_KEY_HEADER] = this.apiKey;
|
|
508
510
|
} else {
|