Affects: Spring-web 5.1.11 & 5.2.1

Spring-web got in version 5.1.11 very useful feature to transfer headers from ResponseExceptions to ResponseStatusExceptionHandler (first mentioned in https://github.com/spring-projects/spring-framework/issues/23741 and implements in https://github.com/spring-projects/spring-framework/commit/614c7b0f8e331dcd665a17caa0ee567254cb8889).

Faced with problem: new mechanism can't transfer multivalues headers like

WWW-Authenticate: Negotiate, NTLM

in raw-style (in a Map<String, List<String>> in this case). ResponseStatusException.getHeaders returns simple java.util.Map. Nowadays I can transfer multivalues only by converting to delimeted string (for example) and from it in exception handler. Looks lile a bycicle :(

Listing in org.springframework.web.server.ResponseStatusException

/**
 * Return response headers associated with the exception, possibly required
 * for the given status code (e.g. "Allow", "Accept").
 * @since 5.1.11
 */
public Map<String, String> getHeaders() {
    return Collections.emptyMap();
}

Listing in org.springframework.web.server.handler.ResponseStatusExceptionHandler

private boolean updateResponse(ServerHttpResponse response, Throwable ex) {
    boolean result = false;
    HttpStatus status = determineStatus(ex);
    if (status != null) {
        if (response.setStatusCode(status)) {
            if (ex instanceof ResponseStatusException) {
                ((ResponseStatusException) ex).getHeaders()
                        .forEach((name, value) -> response.getHeaders().add(name, value));
            }
            result = true;
        }
    }
    else {
        Throwable cause = ex.getCause();
        if (cause != null) {
            result = updateResponse(response, cause);
        }
    }
    return result;
}

Note, that ServerHttpResponse.getHeaders() returns HttpHeaders that implements MultiValueMap<String, String>

Are any restrictions here for using MultiValueMap in ResponseStatusException.getHeaders() instead of Map?

Seems better to have more flexible mech