Skip to content

Commit 8a150ee

Browse files
committed
Fix order of headers in DefaultHandlerExceptionResolver
Closes gh-26470
1 parent 6051f4e commit 8a150ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -278,11 +278,11 @@ protected ModelAndView handleHttpRequestMethodNotSupported(HttpRequestMethodNotS
278278
protected ModelAndView handleHttpMediaTypeNotSupported(HttpMediaTypeNotSupportedException ex,
279279
HttpServletRequest request, HttpServletResponse response, @Nullable Object handler) throws IOException {
280280

281-
response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
282281
List<MediaType> mediaTypes = ex.getSupportedMediaTypes();
283282
if (!CollectionUtils.isEmpty(mediaTypes)) {
284283
response.setHeader("Accept", MediaType.toString(mediaTypes));
285284
}
285+
response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
286286
return new ModelAndView();
287287
}
288288

0 commit comments

Comments
 (0)