-
Notifications
You must be signed in to change notification settings - Fork 445
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
Cannot display the reponse if it cannot format it #14
Comments
@StephD, could you please the error sample in more details, is the '<' in response header, or body? |
I get this error too, but i'm not sure about the exact circumstances. Here is the error from the console: shell.ts:416 data.replace is not a function: TypeError: data.replace is not a function |
@lypscan it's very strange that string.replace is not a function, can you reproduce this? And could you please provide the request so that I can verify it. 😄 |
@lypscan, I can't view your image |
Steps to reproduce:
|
VSCode: 1.3.1 I can view it. But it's from a different source for me. This is this tag ' lypscan, it display the previous data because it can't display the new one (is there a cache?). I just copy the url into the browser and this is 2 picture from firefox developer that have a better display. Chrome only display the raw message. |
@Huachao, this bug was not present before the updates (of VSCode 1.3.1 and REST-Client 0.5.3) |
@StephD @lypscan I think this maybe related to the change in v0.5.3, that I will call escape method for each response header value. And I can repro it in my local, I will look into it now. |
@StephD @lypscan I have created the new version 0.5.4, you can update to it and the bug should have be solved. Great thanks to you 😄 |
GET http://google.com HTTP/1.1 is working. |
@Huachao Yes, for me, this issue is no longer present. Thanks! |
@StephD , could you please provide me the raw request that you issued so that I can debug? Thanks in advance |
Check my previous comment. This is this tag ' |
@StephD. sorry for bothering you to repeat again, and is this the response body, if it is, I can't repro this error since in my code return escape the response body? |
It's alright :) The problem is that the browser and your extension can't render/format the json code because it's not json (But you know that). Btw, the browser, or other app allow to display the raw/pure data without format it. (as shown into my previous post picture). That allow my to view where come from the error and fix it. Your extension doesn't allow to view raw data because it force the json format and get an error if not working (I suppose). May be you should parse the json and if you got an error, just display the data without parsing it. I don't know the extension language or VSC code, .... So this is just PHP exemple :( I hope you understand what I'm trying to say :) ps : XML format doesn't display VSC error because Notice: Undefined variable: params in C:\var\www******.php on line 58 Nothing has been found |
@StephD, I know your pain now, do you mean that you have a response body with Cotent-Type is application/json, while the result is not real json(due to some bug), so my code failed at json parse. The expected behavior is that if parse failed, just display the original(raw) response body? |
True. I used to call the result the response body (after the CRLF, after the header). Not sure about to standard term. The content-type is application/json and the result isn't real json because there is an error message. I would be nice to display the raw data when the parse failed and display an error message to say that the json.parse didn't work). |
@StephD, nice suggestion that add a error/warning message as well when displaying raw response. And I will fix it ASAP |
@StephD you can try latest version 0.5.5 😅 |
Awsome, thanks :) |
When the response contain element that cannot be parsed (Php error as exemple), it display the last preview or display an error message : "Unable to open '\response-preview': Unexpected token <."
It would be great to display raw data to be able to read the error.
Cheers
The text was updated successfully, but these errors were encountered: