File tree Expand file tree Collapse file tree 1 file changed +1
-4
lines changed
web/src/test/java/org/springframework/security/web/server/csrf Expand file tree Collapse file tree 1 file changed +1
-4
lines changed Original file line number Diff line number Diff line change 23
23
24
24
import org .springframework .http .HttpStatus ;
25
25
import org .springframework .http .MediaType ;
26
- import org .springframework .http .server .reactive .ServerHttpRequest ;
27
26
import org .springframework .mock .http .server .reactive .MockServerHttpRequest ;
28
27
import org .springframework .mock .web .server .MockServerWebExchange ;
29
28
import org .springframework .security .web .server .util .matcher .ServerWebExchangeMatcher ;
@@ -190,9 +189,7 @@ public void filterWhenPostAndEstablishedCsrfTokenAndHeaderValidTokenThenContinue
190
189
@ Test
191
190
// gh-8452
192
191
public void matchesRequireCsrfProtectionWhenNonStandardHTTPMethodIsUsed () {
193
- ServerHttpRequest nonStandardHttpRequest = mock (ServerHttpRequest .class );
194
- ServerWebExchange nonStandardHttpExchange = mock (ServerWebExchange .class );
195
- when (nonStandardHttpExchange .getRequest ()).thenReturn (nonStandardHttpRequest );
192
+ MockServerWebExchange nonStandardHttpExchange = from (MockServerHttpRequest .method ("non-standard-http-method" , "/" ));
196
193
197
194
ServerWebExchangeMatcher serverWebExchangeMatcher = CsrfWebFilter .DEFAULT_CSRF_MATCHER ;
198
195
assertThat (serverWebExchangeMatcher .matches (nonStandardHttpExchange ).map (MatchResult ::isMatch ).block ()).isTrue ();
You can’t perform that action at this time.
0 commit comments