Fix regression in ProducesRequestCondition

Closes gh-22853
This commit is contained in:
Rossen Stoyanchev
2019-05-01 02:59:19 -04:00
parent a8f845c944
commit b5327ef60f
4 changed files with 52 additions and 10 deletions

View File

@@ -185,9 +185,12 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
@Override
@Nullable
public ProducesRequestCondition getMatchingCondition(ServerWebExchange exchange) {
if (isEmpty() || CorsUtils.isPreFlightRequest(exchange.getRequest())) {
if (CorsUtils.isPreFlightRequest(exchange.getRequest())) {
return EMPTY_CONDITION;
}
if (isEmpty()) {
return this;
}
Set<ProduceMediaTypeExpression> result = new LinkedHashSet<>(this.expressions);
result.removeIf(expression -> !expression.match(exchange));
if (!result.isEmpty()) {