Skip to content

Commit 1dd0c2e

Browse files
authored
Adds test case for mixed body param and path params (OpenFeign#421)
See OpenFeign#399
1 parent 3c23f1d commit 1dd0c2e

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎core/src/test/java/feign/DefaultContractTest.java‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ public void bodyParamIsGeneric() throws Exception {
7070
}.getType());
7171
}
7272

73+
@Test
74+
public void bodyParamWithPathParam() throws Exception {
75+
MethodMetadata md = parseAndValidateMetadata(BodyParams.class, "post", int.class, List.class);
76+
77+
assertThat(md.bodyIndex())
78+
.isEqualTo(1);
79+
assertThat(md.indexToName()).containsOnly(
80+
entry(0, asList("id"))
81+
);
82+
}
83+
7384
@Test
7485
public void tooManyBodies() throws Exception {
7586
thrown.expect(IllegalStateException.class);
@@ -359,6 +370,9 @@ interface BodyParams {
359370
@RequestLine("POST")
360371
Response post(List<String> body);
361372

373+
@RequestLine("PUT /offers/{id}")
374+
void post(@Param("id") int id, List<String> body);
375+
362376
@RequestLine("POST")
363377
Response tooMany(List<String> body, List<String> body2);
364378
}

0 commit comments

Comments
 (0)