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
c8fded80
Commit
c8fded80
authored
Feb 09, 2017
by
lowzj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix gh-1672, support @RequestParam without a value
parent
c6a3157f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
SpringMvcContract.java
...mework/cloud/netflix/feign/support/SpringMvcContract.java
+1
-4
SpringMvcContractTests.java
...k/cloud/netflix/feign/support/SpringMvcContractTests.java
+18
-0
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/support/SpringMvcContract.java
View file @
c8fded80
...
...
@@ -28,7 +28,6 @@ import java.util.LinkedHashMap;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.cloud.netflix.feign.AnnotatedParameterProcessor
;
import
org.springframework.cloud.netflix.feign.annotation.PathVariableParameterProcessor
;
import
org.springframework.cloud.netflix.feign.annotation.RequestHeaderParameterProcessor
;
...
...
@@ -324,9 +323,7 @@ public class SpringMvcContract extends Contract.BaseContract
// has a parameter name
return
parameterNames
!=
null
&&
parameterNames
.
length
>
parameterIndex
// has a type
&&
parameterTypes
!=
null
&&
parameterTypes
.
length
>
parameterIndex
// and it is a simple property
&&
BeanUtils
.
isSimpleProperty
(
parameterTypes
[
parameterIndex
].
getClass
());
&&
parameterTypes
!=
null
&&
parameterTypes
.
length
>
parameterIndex
;
}
private
class
SimpleAnnotatedParameterContext
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/support/SpringMvcContractTests.java
View file @
c8fded80
...
...
@@ -298,6 +298,19 @@ public class SpringMvcContractTests {
}
@Test
public
void
testProcessAnnotations_ListParamsWithoutName
()
throws
Exception
{
Method
method
=
TestTemplate_ListParamsWithoutName
.
class
.
getDeclaredMethod
(
"getTest"
,
List
.
class
);
MethodMetadata
data
=
this
.
contract
.
parseAndValidateMetadata
(
method
.
getDeclaringClass
(),
method
);
assertEquals
(
"/test"
,
data
.
template
().
url
());
assertEquals
(
"GET"
,
data
.
template
().
method
());
assertEquals
(
"[{id}]"
,
data
.
template
().
queries
().
get
(
"id"
).
toString
());
assertNotNull
(
data
.
indexToExpander
().
get
(
0
));
}
@Test
public
void
testProcessAnnotations_MapParams
()
throws
Exception
{
Method
method
=
TestTemplate_MapParams
.
class
.
getDeclaredMethod
(
"getTest"
,
Map
.
class
);
...
...
@@ -457,6 +470,11 @@ public class SpringMvcContractTests {
ResponseEntity
<
TestObject
>
getTest
(
@RequestParam
(
"id"
)
List
<
String
>
id
);
}
public
interface
TestTemplate_ListParamsWithoutName
{
@RequestMapping
(
value
=
"/test"
,
method
=
RequestMethod
.
GET
)
ResponseEntity
<
TestObject
>
getTest
(
@RequestParam
List
<
String
>
id
);
}
public
interface
TestTemplate_MapParams
{
@RequestMapping
(
value
=
"/test"
,
method
=
RequestMethod
.
GET
)
ResponseEntity
<
TestObject
>
getTest
(
@RequestParam
Map
<
String
,
String
>
params
);
...
...
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