Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FeignException::responseBody() returns request body instead of response body #2619

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gromspys
Copy link
Contributor

Issue: #2618

@@ -490,7 +490,7 @@ void throwsFeignExceptionIncludingBody() {
} catch (FeignException e) {
assertThat(e.getMessage())
.isEqualTo("timeout reading POST http://localhost:" + server.getPort() + "/");
assertThat(e.contentUTF8()).isEqualTo("Request body");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, backwards compatibility is my main concern here.

I think we need to deprecate contentUTF8, keep response body as result of contentUTF8 and introduce resquestBody and responseBody or something with that meaning.

Breaking compatibility like this only on major releases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there is also the same bug, because contentUTF8() method contains following code:

public String contentUTF8() {
    if (responseBody != null) {
      return new String(responseBody, UTF_8);
    } else {
      return "";
    }
  }

Also content() method is deprecated and method responseBody() already exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example in this case contentUTF8() returns response body hello world

@velo velo added breaking change Change that proposes a non-backward compatible breaking change feedback provided Feedback has been provided to the author labels Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Change that proposes a non-backward compatible breaking change feedback provided Feedback has been provided to the author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants