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:
Arjen Poutsma
2017-01-30 14:18:46 +01:00
parent b487ed6748
commit 69c16f3821
7 changed files with 62 additions and 29 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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