Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ufuk/6c2f92bdd5963347e3a826fd99be4ff5 to your computer and use it in GitHub Desktop.

Select an option

Save ufuk/6c2f92bdd5963347e3a826fd99be4ff5 to your computer and use it in GitHub Desktop.
Spring RestTemplate Issue - Can't read response body when the HTTP request has return status 401
// Use HttpComponentsClientHttpRequestFactory to fix the issue
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
...
RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment