Merge branch '2.1.x'

# Conflicts:
#	pom.xml
#	spring-cloud-openfeign-dependencies/pom.xml
This commit is contained in:
Olga Maciaszek-Sharma
2019-04-02 18:00:43 +02:00
3 changed files with 19 additions and 2 deletions

View File

@@ -15,7 +15,7 @@
<properties>
<docs.main>spring-cloud-openfeign</docs.main>
<main.basedir>${basedir}/..</main.basedir>
<docs.whitelisted.branches>2.0.x</docs.whitelisted.branches>
<docs.whitelisted.branches>2.0.x,2.1.x</docs.whitelisted.branches>
</properties>
<build>
<plugins>

View File

@@ -56,7 +56,8 @@ public final class FeignUtils {
static Collection<String> addTemplateParameter(Collection<String> possiblyNull,
String paramName) {
Collection<String> params = ofNullable(possiblyNull).orElse(new ArrayList<>());
Collection<String> params = ofNullable(possiblyNull).map(ArrayList::new)
.orElse(new ArrayList<>());
params.add(String.format("{%s}", paramName));
return params;
}

View File

@@ -523,6 +523,18 @@ public class SpringMvcContractTests {
this.contract.parseAndValidateMetadata(method.getDeclaringClass(), method);
}
@Test
public void testAddingTemplatedParameterWithTheSameKey()
throws NoSuchMethodException {
Method method = TestTemplate_Advanced.class.getDeclaredMethod(
"testAddingTemplatedParamForExistingKey", String.class);
MethodMetadata data = contract
.parseAndValidateMetadata(method.getDeclaringClass(), method);
assertThat(data.template().headers().get("Accept")).contains("application/json",
"{Accept}");
}
public interface TestTemplate_Simple {
@RequestMapping(value = "/test/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@@ -645,6 +657,10 @@ public class SpringMvcContractTests {
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
TestObject getTest();
@GetMapping(produces = "application/json")
String testAddingTemplatedParamForExistingKey(
@RequestHeader("Accept") String accept);
}
public interface TestTemplate_DateTimeFormatParameter {