Skip to content

Commit 176d9e2

Browse files
Modified Validation of node environment
1 parent e8ece67 commit 176d9e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/HTTPClientFactory.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ import { RetryHandler } from "./middleware/RetryHandler";
2525
* @returns A boolean representing the environment is node or not
2626
*/
2727
const isNodeEnvironment = (): boolean => {
28-
return typeof exports !== "undefined" && this.exports !== exports;
28+
return new Function("try {return this === global;}catch(e){return false;}")(); // tslint:disable-line: function-constructor
2929
};
30+
3031
/**
3132
* @class
3233
* Class representing HTTPClientFactory

0 commit comments

Comments
 (0)