Skip to content

Commit

Permalink
Merge pull request #33634 from junhyeongkim2
Browse files Browse the repository at this point in the history
* pr/33634:
  Use HttpMethod.GET for better readability

Closes gh-33634
  • Loading branch information
snicoll committed Oct 4, 2024
2 parents b54420f + a668580 commit c41f8ea
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.springframework.context.Lifecycle;
import org.springframework.context.SmartLifecycle;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.lang.Nullable;
import org.springframework.web.context.ServletContextAware;
import org.springframework.web.servlet.HandlerExecutionChain;
Expand Down Expand Up @@ -126,7 +127,7 @@ private boolean matchWebSocketUpgrade(@Nullable Object handler, HttpServletReque
handler = (handler instanceof HandlerExecutionChain chain ? chain.getHandler() : handler);
if (this.webSocketUpgradeMatch && handler instanceof WebSocketHttpRequestHandler) {
String header = request.getHeader(HttpHeaders.UPGRADE);
return (request.getMethod().equals("GET") &&
return (HttpMethod.GET.matches(request.getMethod()) &&
header != null && header.equalsIgnoreCase("websocket"));
}
return true;
Expand Down

0 comments on commit c41f8ea

Please sign in to comment.