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
c6fa1627
Commit
c6fa1627
authored
Sep 22, 2017
by
Ryan Baxter
Committed by
GitHub
Sep 22, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2293 from mattjbray/fix-requestmapping-headers
SpringMvcContract: Ignore RequestMapping headers with no value.
parents
7672ee36
527dc2cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
SpringMvcContract.java
...mework/cloud/netflix/feign/support/SpringMvcContract.java
+3
-1
SpringMvcContractTests.java
...k/cloud/netflix/feign/support/SpringMvcContractTests.java
+17
-0
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/support/SpringMvcContract.java
View file @
c6fa1627
...
...
@@ -275,8 +275,10 @@ public class SpringMvcContract extends Contract.BaseContract
if
(
annotation
.
headers
()
!=
null
&&
annotation
.
headers
().
length
>
0
)
{
for
(
String
header
:
annotation
.
headers
())
{
int
index
=
header
.
indexOf
(
'='
);
md
.
template
().
header
(
resolve
(
header
.
substring
(
0
,
index
)),
if
(!
header
.
contains
(
"!="
)
&&
index
>=
0
)
{
md
.
template
().
header
(
resolve
(
header
.
substring
(
0
,
index
)),
resolve
(
header
.
substring
(
index
+
1
).
trim
()));
}
}
}
}
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/support/SpringMvcContractTests.java
View file @
c6fa1627
...
...
@@ -333,6 +333,18 @@ public class SpringMvcContractTests {
}
@Test
public
void
testProcessHeadersWithoutValues
()
throws
Exception
{
Method
method
=
TestTemplate_HeadersWithoutValues
.
class
.
getDeclaredMethod
(
"getTest"
,
String
.
class
);
MethodMetadata
data
=
this
.
contract
.
parseAndValidateMetadata
(
method
.
getDeclaringClass
(),
method
);
assertEquals
(
"/test/{id}"
,
data
.
template
().
url
());
assertEquals
(
"GET"
,
data
.
template
().
method
());
assertEquals
(
true
,
data
.
template
().
headers
().
isEmpty
());
}
@Test
public
void
testProcessAnnotations_Fallback
()
throws
Exception
{
Method
method
=
TestTemplate_Advanced
.
class
.
getDeclaredMethod
(
"getTestFallback"
,
String
.
class
,
String
.
class
,
Integer
.
class
);
...
...
@@ -462,6 +474,11 @@ public class SpringMvcContractTests {
ResponseEntity
<
TestObject
>
getTest
(
@PathVariable
(
"id"
)
String
id
);
}
public
interface
TestTemplate_HeadersWithoutValues
{
@RequestMapping
(
value
=
"/test/{id}"
,
method
=
RequestMethod
.
GET
,
headers
=
{
"X-Foo"
,
"!X-Bar"
,
"X-Baz!=fooBar"
})
ResponseEntity
<
TestObject
>
getTest
(
@PathVariable
(
"id"
)
String
id
);
}
public
interface
TestTemplate_ListParams
{
@RequestMapping
(
value
=
"/test"
,
method
=
RequestMethod
.
GET
)
ResponseEntity
<
TestObject
>
getTest
(
@RequestParam
(
"id"
)
List
<
String
>
id
);
...
...
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