spring-cloud / spring-cloud/spring-cloud-config

UnknownContentTypeException when client authentication to server fails

Open
#1,723 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Java
Stars
2k
Forks
1.3k
Avg merge
2d 59m
Merged PRs (30d)
16

Description

When the server has Spring Security, like a basic auth username and password, and the client is misconfigured you get this error:

Caused by: org.springframework.web.client.UnknownContentTypeException: Could not extract response: no suitable HttpMessageConverter found for response type [class org.springframework.cloud.config.environment.Environment] and content type [text/html;charset=UTF-8]

This is very misleading to the user. Since the endpoint does return a 403, it should be simple to improve the error handling for the user. Here is an example of someone running into the error on StackOverflow https://stackoverflow.com/questions/59941635/spring-boot-2-2-2-release-could-not-locate-propertysource-could-not-extract

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names a Spring Security-protected server, a misconfigured client, and an endpoint returning 403, but no files or tests. Reproduce the failure and trace how the client handles that response; done should mean authentication failures produce a clear error instead of UnknownContentTypeException, with coverage for the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
api, backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.