Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
0c4a46be
Commit
0c4a46be
authored
May 30, 2018
by
Jawher Moussa
Committed by
Ryan Baxter
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Zuul's RequestContext.getOriginResponseHeaders not being populated (#2980)
Fixes #2979
parent
038106de
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
ProxyRequestHelper.java
...mework/cloud/netflix/zuul/filters/ProxyRequestHelper.java
+2
-0
ProxyRequestHelperTests.java
...k/cloud/netflix/zuul/filters/ProxyRequestHelperTests.java
+24
-0
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/ProxyRequestHelper.java
View file @
0c4a46be
...
...
@@ -161,6 +161,8 @@ public class ProxyRequestHelper {
for
(
Entry
<
String
,
List
<
String
>>
header
:
headers
.
entrySet
())
{
String
name
=
header
.
getKey
();
for
(
String
value
:
header
.
getValue
())
{
context
.
addOriginResponseHeader
(
name
,
value
);
if
(
name
.
equalsIgnoreCase
(
HttpHeaders
.
CONTENT_ENCODING
)
&&
HTTPRequestUtils
.
getInstance
().
isGzipped
(
value
))
{
isOriginResponseGzipped
=
true
;
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/ProxyRequestHelperTests.java
View file @
0c4a46be
...
...
@@ -19,6 +19,7 @@ package org.springframework.cloud.netflix.zuul.filters;
import
java.io.IOException
;
import
java.util.List
;
import
com.netflix.util.Pair
;
import
com.netflix.zuul.context.RequestContext
;
import
org.junit.After
;
...
...
@@ -37,6 +38,7 @@ import org.springframework.util.LinkedMultiValueMap;
import
org.springframework.util.MultiValueMap
;
import
static
org
.
hamcrest
.
Matchers
.
contains
;
import
static
org
.
hamcrest
.
Matchers
.
containsInAnyOrder
;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
hamcrest
.
Matchers
.
hasSize
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
...
...
@@ -228,6 +230,28 @@ public class ProxyRequestHelperTests {
}
@Test
public
void
setResponseShouldSetOriginResponseHeaders
()
throws
IOException
{
MockHttpServletRequest
request
=
new
MockHttpServletRequest
(
"POST"
,
"/"
);
MockHttpServletResponse
response
=
new
MockHttpServletResponse
();
RequestContext
context
=
RequestContext
.
getCurrentContext
();
context
.
setRequest
(
request
);
context
.
setResponse
(
response
);
ProxyRequestHelper
helper
=
new
ProxyRequestHelper
();
MultiValueMap
<
String
,
String
>
headers
=
new
HttpHeaders
();
headers
.
add
(
HttpHeaders
.
CONTENT_TYPE
,
"text/plain"
);
headers
.
add
(
"some-header"
,
"some-value"
);
helper
.
setResponse
(
200
,
request
.
getInputStream
(),
headers
);
assertThat
(
context
.
getOriginResponseHeaders
(),
containsInAnyOrder
(
new
Pair
<>(
HttpHeaders
.
CONTENT_TYPE
,
"text/plain"
),
new
Pair
<>(
"some-header"
,
"some-value"
)
));
}
@Test
public
void
setResponseUppercase
()
throws
IOException
{
MockHttpServletRequest
request
=
new
MockHttpServletRequest
(
"POST"
,
"/"
);
MockHttpServletResponse
response
=
new
MockHttpServletResponse
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment