Skip to content

Commit

Permalink
Check HttpServletRequest before casting
Browse files Browse the repository at this point in the history
  • Loading branch information
imesh94 committed Oct 28, 2024
1 parent f5a8866 commit c20855a
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,10 @@ public void destroy() {
public boolean shouldPublishCurrentRequestData(ServletRequest request) {

// If the request is internal traffic, no need to publish data
return expectedExternalTrafficHeaderValue.equalsIgnoreCase(
((HttpServletRequest) request).getHeader(externalTrafficHeaderName));
if (request instanceof HttpServletRequest) {
return expectedExternalTrafficHeaderValue.equalsIgnoreCase(
((HttpServletRequest) request).getHeader(externalTrafficHeaderName));
}
return false;
}
}

0 comments on commit c20855a

Please sign in to comment.