Skip to content

Commit 1a1cc3e

Browse files
committed
update checking method
As axios require "process" in the package but woocommerce-rest-api-js-lib do not. Change to use window element to check if it is node.
1 parent 7bb7f21 commit 1a1cc3e

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

index.mjs

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

0 commit comments

Comments
 (0)