Skip to content

Commit f3680b1

Browse files
committed
fix module error in browser
Signed-off-by: Najam Ul Saqib <najamulsaqib@tutamail.com>
1 parent 4ebb1da commit f3680b1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/main/zapHomeFiles/hud/utils.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,9 @@ const utils = (function () {
735735
return dateObject.toISOString().slice(11, 23);
736736
}
737737

738-
module.exports = {
738+
if (typeof module == 'object') // This if check is for unit tests as they work in Node environment only because module.exports is not supported in browser
739+
{
740+
module.exports = {
739741
parseRequestHeader,
740742
parseResponseHeader,
741743
isFromTrustedOrigin,
@@ -769,6 +771,7 @@ const utils = (function () {
769771
log,
770772
timestampToTimeString
771773
};
774+
}
772775
return {
773776
parseRequestHeader,
774777
parseResponseHeader,

src/webpack/loaders/zap-loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = function zapLoader(source) {
33
source = source.replace('<<ZAP_HUD_URL>>', 'https://targetdomain.com');
44
source = source.replace('<<ZAP_HUD_API>>', 'https://zap/api');
55
source = source.replace('<<ZAP_HUD_WS>>', 'https://zap/websocket');
6-
source = source.replace('<<ZAP_HUD_TOOLS>>', '\'http://zap/to/some/tool\'');
6+
source = source.replace('<<ZAP_HUD_TOOLS>>', 'http://zap/to/some/tool');
77
source = source.replace('<<ZAP_SHARED_SECRET>>', 'sometestsecret');
88

99
return source;

0 commit comments

Comments
 (0)