Add headers in InterceptingClientHttpRequest
This commit *adds* the "intercepted" headers to the ClientHttpRequest, as opposed to replacing them, which is what happened before this commit. Issue: SPR-15166
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -406,14 +406,16 @@ public abstract class CollectionUtils {
|
||||
|
||||
@Override
|
||||
public void add(K key, V value) {
|
||||
List<V> values = this.map.get(key);
|
||||
if (values == null) {
|
||||
values = new LinkedList<>();
|
||||
this.map.put(key, values);
|
||||
}
|
||||
List<V> values = this.map.computeIfAbsent(key, k -> new LinkedList<>());
|
||||
values.add(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAll(K key, List<V> values) {
|
||||
List<V> currentValues = this.map.computeIfAbsent(key, k -> new LinkedList<>());
|
||||
currentValues.addAll(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public V getFirst(K key) {
|
||||
List<V> values = this.map.get(key);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -75,14 +75,16 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
|
||||
|
||||
@Override
|
||||
public void add(K key, V value) {
|
||||
List<V> values = this.targetMap.get(key);
|
||||
if (values == null) {
|
||||
values = new LinkedList<>();
|
||||
this.targetMap.put(key, values);
|
||||
}
|
||||
List<V> values = this.targetMap.computeIfAbsent(key, k -> new LinkedList<>());
|
||||
values.add(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAll(K key, List<V> values) {
|
||||
List<V> currentValues = this.targetMap.computeIfAbsent(key, k -> new LinkedList<>());
|
||||
currentValues.addAll(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public V getFirst(K key) {
|
||||
List<V> values = this.targetMap.get(key);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -41,6 +41,13 @@ public interface MultiValueMap<K, V> extends Map<K, List<V>> {
|
||||
*/
|
||||
void add(K key, V value);
|
||||
|
||||
/**
|
||||
* Add all the values of the given list to the current list of values for the given key.
|
||||
* @param key they key
|
||||
* @param values the values to be added
|
||||
*/
|
||||
void addAll(K key, List<V> values);
|
||||
|
||||
/**
|
||||
* Set the given single value under the given key.
|
||||
* @param key the key
|
||||
|
||||
Reference in New Issue
Block a user