Search in sources :

Example 1 with NoEncodingFormHttpMessageConverter

use of org.springframework.cloud.netflix.zuul.filters.route.support.NoEncodingFormHttpMessageConverter in project spring-cloud-netflix by spring-cloud.

the class RestClientRibbonCommandIntegrationTests method javascriptEncodedFormParams.

@Override
@SuppressWarnings("deprecation")
@Test
public void javascriptEncodedFormParams() {
    TestRestTemplate testRestTemplate = new TestRestTemplate();
    ArrayList<HttpMessageConverter<?>> converters = new ArrayList<>();
    converters.addAll(Arrays.asList(new StringHttpMessageConverter(), new NoEncodingFormHttpMessageConverter()));
    testRestTemplate.getRestTemplate().setMessageConverters(converters);
    MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
    map.add("foo", "(bar)");
    ResponseEntity<String> result = testRestTemplate.postForEntity("http://localhost:" + this.port + "/simple/local", map, String.class);
    assertEquals(HttpStatus.OK, result.getStatusCode());
    assertEquals("Posted [(bar)] and Content-Length was: -1!", result.getBody());
}
Also used : TestRestTemplate(org.springframework.boot.test.web.client.TestRestTemplate) LinkedMultiValueMap(org.springframework.util.LinkedMultiValueMap) StringHttpMessageConverter(org.springframework.http.converter.StringHttpMessageConverter) HttpMessageConverter(org.springframework.http.converter.HttpMessageConverter) NoEncodingFormHttpMessageConverter(org.springframework.cloud.netflix.zuul.filters.route.support.NoEncodingFormHttpMessageConverter) ArrayList(java.util.ArrayList) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) StringHttpMessageConverter(org.springframework.http.converter.StringHttpMessageConverter) NoEncodingFormHttpMessageConverter(org.springframework.cloud.netflix.zuul.filters.route.support.NoEncodingFormHttpMessageConverter) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 TestRestTemplate (org.springframework.boot.test.web.client.TestRestTemplate)1 NoEncodingFormHttpMessageConverter (org.springframework.cloud.netflix.zuul.filters.route.support.NoEncodingFormHttpMessageConverter)1 HttpMessageConverter (org.springframework.http.converter.HttpMessageConverter)1 StringHttpMessageConverter (org.springframework.http.converter.StringHttpMessageConverter)1 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)1