Affects: 6.0.12
Hi, team.
In Spring 5.3.29, HttpMethod#valueOf
throws an exception when it receives a non-existent value as a parameter. However, in Spring 6.0.12, a non-existent HttpMethod does not raise an exception. I think it's right that the exception should be thrown, but please let me know why this was changed.
v5.3.29
https://github.com/spring-projects/spring-framework/blob/de0cb533942fc25d2cbe00b71225b7d8f07e0a6d/spring-web/src/main/java/org/springframework/http/HttpMethod.java#L33-L35
v6.0.12
https://github.com/spring-projects/spring-framework/blob/8770544769367b780b3667b832920c78d4a87611/spring-web/src/main/java/org/springframework/http/HttpMethod.java#L115-L128
If you think it is correct to throw an exception in the default case, I will create a new PR.
Thanks 👍
Comment From: quaff
Comment From: snicoll
Thanks for the report. What @quaff said, more details to be found in https://github.com/spring-projects/spring-framework/issues/29981. You can use RequestMethod#resolve
and throw an exception if the return value is null
.