Deprecate and set trailingSlash option to false

Closes gh-28552
This commit is contained in:
rstoyanchev
2022-06-29 16:08:37 +01:00
parent d2e27ad754
commit b312eca391
27 changed files with 84 additions and 82 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -358,7 +358,10 @@ public interface MockMvcWebTestClient {
* Whether to match trailing slashes.
* <p>This is delegated to
* {@link StandaloneMockMvcBuilder#setUseTrailingSlashPatternMatch(boolean)}.
* @deprecated as of 6.0, see
* {@link PathPatternParser#setMatchOptionalTrailingSeparator(boolean)}
*/
@Deprecated
ControllerSpec useTrailingSlashPatternMatch(boolean useTrailingSlashPatternMatch);
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -152,6 +152,7 @@ class StandaloneMockMvcSpec extends AbstractMockMvcServerSpec<MockMvcWebTestClie
return this;
}
@SuppressWarnings("deprecation")
@Override
public StandaloneMockMvcSpec useTrailingSlashPatternMatch(boolean useTrailingSlashPatternMatch) {
this.mockMvcBuilder.setUseTrailingSlashPatternMatch(useTrailingSlashPatternMatch);

View File

@@ -343,8 +343,10 @@ public class StandaloneMockMvcBuilder extends AbstractMockMvcBuilder<StandaloneM
/**
* Whether to match to URLs irrespective of the presence of a trailing slash.
* If enabled a method mapped to "/users" also matches to "/users/".
* <p>The default value is {@code true}.
* @deprecated as of 6.0, see
* {@link PathPatternParser#setMatchOptionalTrailingSeparator(boolean)}
*/
@Deprecated
public StandaloneMockMvcBuilder setUseTrailingSlashPatternMatch(boolean useTrailingSlashPatternMatch) {
this.useTrailingSlashPatternMatch = useTrailingSlashPatternMatch;
return this;