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

Response body should not be parsed for "204 No Content" code #598

Closed
YBogomolov opened this issue May 29, 2020 · 3 comments
Closed

Response body should not be parsed for "204 No Content" code #598

YBogomolov opened this issue May 29, 2020 · 3 comments
Labels

Comments

@YBogomolov
Copy link

  • REST Client Version: 0.23.2
  • VSCode Version: 1.45.1
  • OS Version: macOS 10.15.5

Prerequisites:

  1. REST API which responds to POST verb with 204 No Content code, Content-Type: application/json headers and empty body.

Steps to Reproduce:

  1. Create the following REST request:
POST http://host.tld/some-api HTTP/1.1
Content-Type: application/json

{}
  1. Execute the request.

Actual behaviour:

  1. A warning message in the lower right corner stating: The content type of response is application/json, while response body is not a valid json string.
  2. The request is executed successfully.

Expected behaviour:

  1. No warning is displayed.
  2. The request is executed successfully.

Comments:

As per RFC 2616, the server can respond with both Content-Type header and empty body under 204 HTTP code. Please see these links for details:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.5
http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.1

Suggested changes:

  1. Parse response body only if the response code supposes presence of that body.
@Huachao
Copy link
Owner

Huachao commented May 30, 2020

@YBogomolov nice catch, I have fixed this issue and will publish it in the next release.

@Huachao Huachao closed this as completed May 30, 2020
@Huachao
Copy link
Owner

Huachao commented Jun 12, 2020

@YBogomolov you can verify this in the latest version 0.24.0

@YBogomolov
Copy link
Author

@Huachao It works as intended, thank you!

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

No branches or pull requests

2 participants