Skip to content

Commit c41f8ea

Browse files
committed
Merge pull request #33634 from junhyeongkim2
* pr/33634: Use HttpMethod.GET for better readability Closes gh-33634
2 parents b54420f + a668580 commit c41f8ea

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-websocket/src/main/java/org/springframework/web/socket/server/support/WebSocketHandlerMapping.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.springframework.context.Lifecycle;
2323
import org.springframework.context.SmartLifecycle;
2424
import org.springframework.http.HttpHeaders;
25+
import org.springframework.http.HttpMethod;
2526
import org.springframework.lang.Nullable;
2627
import org.springframework.web.context.ServletContextAware;
2728
import org.springframework.web.servlet.HandlerExecutionChain;
@@ -126,7 +127,7 @@ private boolean matchWebSocketUpgrade(@Nullable Object handler, HttpServletReque
126127
handler = (handler instanceof HandlerExecutionChain chain ? chain.getHandler() : handler);
127128
if (this.webSocketUpgradeMatch && handler instanceof WebSocketHttpRequestHandler) {
128129
String header = request.getHeader(HttpHeaders.UPGRADE);
129-
return (request.getMethod().equals("GET") &&
130+
return (HttpMethod.GET.matches(request.getMethod()) &&
130131
header != null && header.equalsIgnoreCase("websocket"));
131132
}
132133
return true;

0 commit comments

Comments
 (0)