rest-nvim / rest.nvim

A fast Neovim http client written in Lua
GNU General Public License v3.0
1.35k stars 118 forks source link

How to pretty print a json response? #363

Closed gzfrozen closed 2 months ago

gzfrozen commented 2 months ago

I set the plugin with the default formatter setting. jq is installed.

I see the json response is not pretty printed as the example shows in the README.md image

Do I need more config?

daniilrozanov commented 2 months ago

I'm not 100% sure that this could be the reason, but maybe your server does not set the application/json field in the header

EDIT. Actually, format strategy strictly depends on header's Content-Type field

gzfrozen commented 2 months ago

@daniilrozanov Thank you for your reply.

Do you mean the content-type header in response? I think it is already set to application/json.

image
daniilrozanov commented 2 months ago

Try to update your plugin. Recently it was case sensitive in relation to the Content-Type field

gzfrozen commented 2 months ago

@daniilrozanov Wow, thanks. The problem is solved after the updating.🎉