Polish
See gh-22598
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -46,7 +46,7 @@ import org.springframework.web.servlet.mvc.condition.HeadersRequestCondition.Hea
|
||||
*/
|
||||
public final class ConsumesRequestCondition extends AbstractRequestCondition<ConsumesRequestCondition> {
|
||||
|
||||
private static final ConsumesRequestCondition PRE_FLIGHT_MATCH = new ConsumesRequestCondition();
|
||||
private static final ConsumesRequestCondition EMPTY_CONDITION = new ConsumesRequestCondition();
|
||||
|
||||
private final List<ConsumeMediaTypeExpression> expressions;
|
||||
|
||||
@@ -163,7 +163,7 @@ public final class ConsumesRequestCondition extends AbstractRequestCondition<Con
|
||||
@Nullable
|
||||
public ConsumesRequestCondition getMatchingCondition(HttpServletRequest request) {
|
||||
if (CorsUtils.isPreFlightRequest(request)) {
|
||||
return PRE_FLIGHT_MATCH;
|
||||
return EMPTY_CONDITION;
|
||||
}
|
||||
if (isEmpty()) {
|
||||
return this;
|
||||
|
||||
@@ -47,8 +47,6 @@ import org.springframework.web.servlet.mvc.condition.HeadersRequestCondition.Hea
|
||||
*/
|
||||
public final class ProducesRequestCondition extends AbstractRequestCondition<ProducesRequestCondition> {
|
||||
|
||||
private static final ProducesRequestCondition PRE_FLIGHT_MATCH = new ProducesRequestCondition();
|
||||
|
||||
private static final ProducesRequestCondition EMPTY_CONDITION = new ProducesRequestCondition();
|
||||
|
||||
private static final List<ProduceMediaTypeExpression> MEDIA_TYPE_ALL_LIST =
|
||||
@@ -187,11 +185,8 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
|
||||
@Override
|
||||
@Nullable
|
||||
public ProducesRequestCondition getMatchingCondition(HttpServletRequest request) {
|
||||
if (CorsUtils.isPreFlightRequest(request)) {
|
||||
return PRE_FLIGHT_MATCH;
|
||||
}
|
||||
if (isEmpty()) {
|
||||
return this;
|
||||
if (isEmpty() || CorsUtils.isPreFlightRequest(request)) {
|
||||
return EMPTY_CONDITION;
|
||||
}
|
||||
|
||||
List<MediaType> acceptedMediaTypes;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -228,10 +228,6 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
|
||||
if (headers == null) {
|
||||
return null;
|
||||
}
|
||||
PatternsRequestCondition patterns = this.patternsCondition.getMatchingCondition(request);
|
||||
if (patterns == null) {
|
||||
return null;
|
||||
}
|
||||
ConsumesRequestCondition consumes = this.consumesCondition.getMatchingCondition(request);
|
||||
if (consumes == null) {
|
||||
return null;
|
||||
@@ -240,6 +236,10 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
|
||||
if (produces == null) {
|
||||
return null;
|
||||
}
|
||||
PatternsRequestCondition patterns = this.patternsCondition.getMatchingCondition(request);
|
||||
if (patterns == null) {
|
||||
return null;
|
||||
}
|
||||
RequestConditionHolder custom = this.customConditionHolder.getMatchingCondition(request);
|
||||
if (custom == null) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user