MessageHeaderAccessor properly removes header even in case of null value
Issue: SPR-14468
(cherry picked from commit b166358)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -306,12 +306,17 @@ public class MessageHeaderAccessor {
|
||||
throw new IllegalArgumentException("'" + name + "' header is read-only");
|
||||
}
|
||||
verifyType(name, value);
|
||||
if (!ObjectUtils.nullSafeEquals(value, getHeader(name))) {
|
||||
this.modified = true;
|
||||
if (value != null) {
|
||||
if (value != null) {
|
||||
// Modify header if necessary
|
||||
if (!ObjectUtils.nullSafeEquals(value, getHeader(name))) {
|
||||
this.modified = true;
|
||||
this.headers.getRawHeaders().put(name, value);
|
||||
}
|
||||
else {
|
||||
}
|
||||
else {
|
||||
// Remove header if available
|
||||
if (this.headers.containsKey(name)) {
|
||||
this.modified = true;
|
||||
this.headers.getRawHeaders().remove(name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user