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.
@@ -17,6 +17,7 @@
package org.springframework.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -25,7 +26,8 @@ import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
/**
* @author Arjen Poutsma
@@ -50,6 +52,18 @@ public class LinkedMultiValueMapTests {
assertEquals(expected, map.get("key"));
}
@Test
public void addAll() throws Exception {
map.add("key", "value1");
map.addAll("key", Arrays.asList("value2", "value3"));
assertEquals(1, map.size());
List<String> expected = new ArrayList<>(2);
expected.add("value1");
expected.add("value2");
expected.add("value3");
assertEquals(expected, map.get("key"));
}
@Test
public void getFirst() {
List<String> values = new ArrayList<>(2);