Skip to content

Revisit empty body response support in HTTP client #715

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

Closed
wants to merge 1 commit into from

Conversation

bclozel
Copy link
Member

@bclozel bclozel commented Dec 31, 2014

Prior to this commit, HTTP responses without body (response status 204
or 304, Content-Length: 0) were handled properly by RestTemplates. But
some other cases were not properly managed, throwing exceptions for
valid HTTP responses.

This commit better handles HTTP responses, using a response wrapper that
can tell if a response:

  • has no message body (HTTP status 1XX, 204, 304 or Content-Length:0)
  • has an empty message body

This covers rfc7230 Section 3.3.3.

Issue: SPR-8016

Prior to this commit, HTTP responses without body (response status 204
or 304, Content-Length: 0) were handled properly by RestTemplates. But
some other cases were not properly managed, throwing exceptions for
valid HTTP responses.

This commit better handles HTTP responses, using a response wrapper that
can tell if a response:

* has no message body (HTTP status 1XX, 204, 304 or Content-Length:0)
* has an empty message body

This covers rfc7230 Section 3.3.3.

Issue: SPR-8016
@colinmorelli
Copy link

👍 looks good

Built my project against this to test it out and it solves the issue I was having as well.

@bclozel
Copy link
Member Author

bclozel commented Dec 31, 2014

great, thanks @colinmorelli - after review, this will be in 4.2 (and backported to 4.1.x as well).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants