Skip to content

Error parsing bug #67

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
timsofteng opened this issue Sep 14, 2021 · 10 comments · Fixed by #125
Closed

Error parsing bug #67

timsofteng opened this issue Sep 14, 2021 · 10 comments · Fixed by #125

Comments

@timsofteng
Copy link

Hello. I faced up with parsing error bug.
Look at the response of the rest.nvim
image
and now look at the response of the same request in insomnia:
image

@NTBBloodbath
Copy link
Member

NTBBloodbath commented Sep 14, 2021

Hey, can you please add an example http file to have a better understanding of what are you trying to do? Remember to remove sensitive data if you need to.

Also if you could explain a bit more about what do you mean with the bug it would be great, right now I understand that the raw message is very different and our error message makes no sense compared with insomnia one, am I right?

Regards

@timsofteng
Copy link
Author

Yes, you are right.
Here is the request.

image

@timsofteng
Copy link
Author

Hello. Have you catch it?

@NTBBloodbath
Copy link
Member

Hi, sorry for the late reply.

It's gonna take a bit of time to me, there's a ton of stuff to debug to know how to handle these errors and I don't know where can I test the authorization things because I currently don't have a local backend haha, it would be really useful if you know a site to test them

@timsofteng
Copy link
Author

You may probably start some local service and raise 401 error with some text.

I believe it's some problem with text reading.
In my example column 8 is space symbol. Maybe pfoblem is there...

@jens1205
Copy link
Contributor

In my opinion the webservice has a bug. You are receiving the text invalid or missing token, but at the same time the content-type header says: `content-type: application/json'. Obiously the plain text is not json.

Try echo "invalid or missing token" | jq and you get the same error you see in rest.nvim: parse error: Invalid numeric literal at line 1, column 8

So, this issue should be closed and the webservice must be fixed. Either return the error in valid JSON, or don't pretend to send back json, but set the content-type to text.

@timsofteng
Copy link
Author

timsofteng commented Sep 29, 2021

In my opinion the webservice has a bug. You are receiving the text invalid or missing token, but at the same time the content-type header says: `content-type: application/json'. Obiously the plain text is not json.

Try echo "invalid or missing token" | jq and you get the same error you see in rest.nvim: parse error: Invalid numeric literal at line 1, column 8

So, this issue should be closed and the webservice must be fixed. Either return the error in valid JSON, or don't pretend to send back json, but set the content-type to text.

Ok, looks like you are right.
BUT
I guess plugin should display content anyway but maybe with some error or hint like "content and body are not the same type!".
It is tool for development. I need to see the body anyway.

@NTBBloodbath
Copy link
Member

Hmm you're right. Actually the error message that you've proposed makes more sense than a JQ parsing error. I'm gonna do some tests today.

@timsofteng
Copy link
Author

Hello. Any updates?

@timsofteng
Copy link
Author

@NTBBloodbath

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 a pull request may close this issue.

3 participants