ServletResponseHttpHeaders consistently overrides HttpHeaders again
Issue: SPR-14406
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.
|
||||
@@ -29,13 +29,12 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.mock.web.test.MockHttpServletResponse;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class ServletServerHttpResponseTests {
|
||||
|
||||
@@ -79,7 +78,6 @@ public class ServletServerHttpResponseTests {
|
||||
|
||||
@Test
|
||||
public void preExistingHeadersFromHttpServletResponse() {
|
||||
|
||||
String headerName = "Access-Control-Allow-Origin";
|
||||
String headerValue = "localhost:8080";
|
||||
|
||||
@@ -89,6 +87,8 @@ public class ServletServerHttpResponseTests {
|
||||
assertEquals(headerValue, this.response.getHeaders().getFirst(headerName));
|
||||
assertEquals(Collections.singletonList(headerValue), this.response.getHeaders().get(headerName));
|
||||
assertTrue(this.response.getHeaders().containsKey(headerName));
|
||||
assertEquals(headerValue, this.response.getHeaders().getFirst(headerName));
|
||||
assertEquals(headerValue, this.response.getHeaders().getAccessControlAllowOrigin());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -98,4 +98,5 @@ public class ServletServerHttpResponseTests {
|
||||
|
||||
assertArrayEquals("Invalid content written", content, mockResponse.getContentAsByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user