Our build is failing when running against the latest Spring Framework snapshot. The test matchesRequireCsrfProtectionWhenNonStandardHTTPMethodIsUsed is failing, because Spring Framework 5.2.7 will no longer allow a null HTTP method. Instead, it provides a method to set a custom HTTP method as a String.

That method is not available in versions prior to 5.2.7, so we cannot use it yet. In order to be compatible with both version of Spring Framework, we should mock ServerHttpRequest in our test, instead of using MockServerHttpRequest.

Once Spring Framework 5.2.7 is available we can switch to using the new builder method. gh-8592 was created to use the new builder method when it becomes available.