Skip to content

Commit 1d42bc3

Browse files
committed
Revert "update checking method"
This reverts commit 1a1cc3e.
1 parent 1a1cc3e commit 1d42bc3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

index.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,11 @@ export default class WooCommerceRestApi {
191191
Accept: "application/json"
192192
};
193193
// only set "User-Agent" in node environment
194-
if (typeof window === "undefined") {
194+
// the checking method is identical to upstream axios
195+
if (
196+
typeof process !== "undefined" &&
197+
Object.prototype.toString.call(process) === "[object process]"
198+
) {
195199
headers["User-Agent"] =
196200
"WooCommerce REST API - JS Client/" + this.classVersion;
197201
}

0 commit comments

Comments
 (0)