[x] I am using the latest stable release of Neovim
[X] I am using the latest version of the plugin
Neovim Version
v0.10.1
Operating system/version
Xubuntu 24.04
Actual behavior
When a request results in a 401 with an empty body, rest.vim dumps a big error trace to the user and gets stuck in a "Loading..." status that never shows the user what the response code of the request was, making it difficult to diagnose.
Expected behavior
The expectation would be that if there is no body to be formatted, rest.nvim would skip the formatting step and this would give the user a results pane that would look like:
HTTP/2 401
# @_RES
# @_END
Steps to reproduce
Run this request with
# GET Test that will return an 401 response with no body content
GET https://api.attentivemobile.com/v1/me
Other information
When using the "Repro" script below, rest.nvim does not yield the error above. Instead it yields the expected result due to the fact that there is no formatting occurring on the response. If I use the repro code and request a working endpoint with valid token, I get back an expected response, but the JSON is not formatted and is just a big long string that is difficult to read.
That recommendation causes the rest responses to be formatted and highlighted in pretty JSON, but seems to have the side effect of rest.nvim not handling the error nicely when there is no body to format.
Prerequisites
Neovim Version
v0.10.1
Operating system/version
Xubuntu 24.04
Actual behavior
When a request results in a 401 with an empty body, rest.vim dumps a big error trace to the user and gets stuck in a "Loading..." status that never shows the user what the response code of the request was, making it difficult to diagnose.
Expected behavior
The expectation would be that if there is no body to be formatted, rest.nvim would skip the formatting step and this would give the user a results pane that would look like:
Steps to reproduce
Run this request with
Other information
When using the "Repro" script below, rest.nvim does not yield the error above. Instead it yields the expected result due to the fact that there is no formatting occurring on the response. If I use the repro code and request a working endpoint with valid token, I get back an expected response, but the JSON is not formatted and is just a big long string that is difficult to read.
To get formatting to work, I followed the guidance from boltlessengineer here: https://github.com/rest-nvim/rest.nvim/issues/414#issuecomment-2308910953.
That recommendation causes the rest responses to be formatted and highlighted in pretty JSON, but seems to have the side effect of rest.nvim not handling the error nicely when there is no body to format.
Repro (
lazy.nvim
)