Search code examples
spring-bootspring-cloudresttemplatespring-cloud-netflix

Calling RestTemplate with Ribbon Interceptor


I am trying to use RestTemplate with @EnableDiscoveryClient which ends up calling the Ribbon Interceptor. Down the call stack, the following call ends up being made:

org.springframework.cloud.netflix.ribbon.RibbonClientHttpRequestFactory$
RibbonHttpRequest.getBodyInternal(RibbonClientHttpRequestFactory.java:105)

Now, here is the code of this getBodyInternal method:

 @Override
 protected OutputStream getBodyInternal(HttpHeaders headers) throws IOException {
        throw new RuntimeException("Not implemented");
 }

My question is what cases lead to this not implemented method and how can I avoid that? I am using RestTemplate.postForLocation. Is it a general assumption that this method should not be called with Ribbon interceptor?


Solution

  • Try with version 1.0.3.RELEASE which is part of spring-cloud-starter-parent:Angel.SR3. That method has been implemented.