Skip to content

Commit 40a7f2e

Browse files
committed
Use userAgent variable
1 parent 622be4e commit 40a7f2e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

library/sources/http-server/checkIfRequestIsBlocked.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,15 @@ export function checkIfRequestIsBlocked(
110110
return true;
111111
}
112112

113-
const isUserAgentBlocked =
114-
context.headers && typeof context.headers["user-agent"] === "string"
115-
? agent.getConfig().isUserAgentBlocked(context.headers["user-agent"])
116-
: ({ blocked: false } as const);
117-
118113
const userAgent =
119114
context.headers && typeof context.headers["user-agent"] === "string"
120115
? context.headers["user-agent"]
121116
: undefined;
122117

118+
const isUserAgentBlocked = userAgent
119+
? agent.getConfig().isUserAgentBlocked(userAgent)
120+
: ({ blocked: false } as const);
121+
123122
if (userAgent) {
124123
const isMonitoredUserAgent = agent
125124
.getConfig()

0 commit comments

Comments
 (0)