Suppress OPTIONS handling for an ERROR dispatch

Issue: SPR-14410
This commit is contained in:
Rossen Stoyanchev
2016-06-30 12:34:54 -04:00
parent 16949941f8
commit 9c29ed75f8
2 changed files with 18 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import javax.servlet.DispatcherType;
import javax.servlet.http.HttpServletRequest;
import org.springframework.http.HttpHeaders;
@@ -109,7 +110,9 @@ public final class RequestMethodsRequestCondition extends AbstractRequestConditi
}
if (getMethods().isEmpty()) {
if (RequestMethod.OPTIONS.name().equals(request.getMethod())) {
if (RequestMethod.OPTIONS.name().equals(request.getMethod()) &&
!DispatcherType.ERROR.equals(request.getDispatcherType())) {
return null; // No implicit match for OPTIONS (we handle it)
}
return this;