Skip to content

Fix: content-type cannot be extracted from headers #255

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

Merged
merged 1 commit into from
Nov 19, 2023

Conversation

eightpigs
Copy link
Contributor

@eightpigs eightpigs commented Nov 16, 2023

Some related issues:

Causes

res.headers is not a key:value table, so it can't extract the content-type properly, as below:

{
  "Content-Type: application/json; charset=utf-8",
  "Date: Thu, 16 Nov 2023 15:54:51 GMT",
  "Content-Length: 614"
}

Fix

convert res.headers to key:value table.

And, I changed headers structures in context: context.result.headers.
Before, it was the above structure, now:

{
  ["Content-Type"]: "application/json; charset=utf-8",
  ["Content-Length"]: "614",
  "Date": "Thu, 16 Nov 2023 15:54:51 GMT"
}

This plugin is awesome, really straightforward and user-friendly. Thanks a lot for your hard work!

@onns
Copy link

onns commented Nov 19, 2023

fix for me, thanks.
图片

taking one hour for me until I found headers' key is index..
I should be looking for issue or mr first next time...

@NTBBloodbath
Copy link
Member

Hey, thank you so much per doing this. The truth is I hadn't had enough time to deal with this and make the patch. Thank you very much for contributing and also thanks to @onns for testing the changes!

Cheers

@NTBBloodbath NTBBloodbath linked an issue Nov 19, 2023 that may be closed by this pull request
@NTBBloodbath NTBBloodbath merged commit c186d3e into rest-nvim:main Nov 19, 2023
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.

Response is no longer formatted after 5bcaa10
3 participants