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.
@@ -397,14 +397,16 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
*/
@Override
public void add(String headerName, String headerValue) {
List<String> headerValues = headers.get(headerName);
if (headerValues == null) {
headerValues = new LinkedList<>();
this.headers.put(headerName, headerValues);
}
List<String> headerValues = headers.computeIfAbsent(headerName, k -> new LinkedList<>());
headerValues.add(headerValue);
}
@Override
public void addAll(String headerName, List<String> headerValues) {
List<String> currentValues = headers.computeIfAbsent(headerName, k -> new LinkedList<>());
currentValues.addAll(headerValues);
}
/**
* Set the given, single header value under the given name.
* @param headerName the header name