Merge branch '2.3.x' into 2.4.x

Closes gh-25786
This commit is contained in:
Phillip Webb
2021-03-24 12:52:51 -07:00
2 changed files with 25 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -254,7 +254,7 @@ public class DefaultErrorWebExceptionHandler extends AbstractErrorWebExceptionHa
return (serverRequest) -> {
try {
List<MediaType> acceptedMediaTypes = serverRequest.headers().accept();
acceptedMediaTypes.remove(MediaType.ALL);
acceptedMediaTypes.removeIf(MediaType.ALL::equalsTypeAndSubtype);
MediaType.sortBySpecificityAndQuality(acceptedMediaTypes);
return acceptedMediaTypes.stream().anyMatch(MediaType.TEXT_HTML::isCompatibleWith);
}