Comments (21)
@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 π
from vscode-restclient.
@StephD, could you please the error sample in more details, is the '<' in response header, or body?
from vscode-restclient.
I get this error too, but i'm not sure about the exact circumstances.
VSCode: 1.3.1
OS: Win 7
Here is the error from the console:
shell.ts:416 data.replace is not a function: TypeError: data.replace is not a function
at Function.HttpResponseTextDocumentContentProvider.escase (C:\Users\user1.vscode\extensions\humao.rest-client-0.5.3\out\src\views\httpResponseTextDocumentContentProvider.js:48:21)
at Function.HttpResponseTextDocumentContentProvider.formatHeaders (C:\Users\user1.vscode\extensions\humao.rest-client-0.5.3\out\src\views\httpResponseTextDocumentContentProvider.js:29:69)
at HttpResponseTextDocumentContentProvider.provideTextDocumentContent (C:\Users\user1.vscode\extensions\humao.rest-client-0.5.3\out\src\views\httpResponseTextDocumentContentProvider.js:12:699)
at c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:10:22159
at c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:7:441
at new n.Class.derive._oncancel (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:5:16489)
at Object.l [as asWinJsPromise](c:Program Files %28x86%29Microsoft VS CoderesourcesappoutvsworkbenchnodeextensionHostProcess.js:7:406)
at e.$provideTextDocumentContent (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:10:22123)
at c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:10:21758
at e.invoke (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:6:23783)
at e.fire (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:6:25565)
at HttpResponseTextDocumentContentProvider.update (C:\Users\user1.vscode\extensions\humao.rest-client-0.5.3\out\src\views\httpResponseTextDocumentContentProvider.js:23:27)
at C:\Users\user1.vscode\extensions\humao.rest-client-0.5.3\out\src\controllers\requestController.js:48:41
at process._tickCallback (internal/process/next_tick.js:103:7)e.onUnexpectedError @ shell.ts:416(anonymous function) @ shell.ts:318e.onUnexpectedError @ errors.ts:73u @ errors.ts:88e.onUnexpectedExtHostError @ mainThreadErrors.ts:12e.handle @ abstractThreadService.ts:34s @ ipcRemoteCom.ts:269f @ ipcRemoteCom.ts:226_combinedTickCallback @ internal/process/next_tick.js:67_tickCallback @ internal/process/next_tick.js:98
from vscode-restclient.
@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. π
from vscode-restclient.
I made a gif with the bug:
from vscode-restclient.
@lypscan, I can't view your image
from vscode-restclient.
Steps to reproduce:
- save a file with the rest extension (test.rest)
- do a GET http://example.com HTTP/1.1
- close the response-view pane
- now change the domain to google.com (GET http://google.com HTTP/1.1)
- this is when i receive the error in the console and the response-view pane pops up with the response data of the previous request (from example.com)
from vscode-restclient.
VSCode: 1.3.1
OS: Win 7
I can view it. But it's from a different source for me.
Now I got another error :
Unable to open '\response-preview': data.replace is not a function.
Here is the answer I get into a browser (as RAW).
Notice: Undefined variable: params in C:\var\www******.php on line 58
{"error":"Nothing has been found"}
This is this tag '
' that made the previous error => Unexpected token <.
lypscan, it display the previous data because it can't display the new one (is there a cache?).
If I close VSC, open it, write "GET http://google.com HTTP/1.1" into a new file and run the command, I get the error :
Unable to open '\response-preview': data.replace is not a function.
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.
from vscode-restclient.
@Huachao, this bug was not present before the updates (of VSCode 1.3.1 and REST-Client 0.5.3)
from vscode-restclient.
@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.
from vscode-restclient.
GET http://google.com HTTP/1.1 is working.
My other link is back to the previous error : "Unable to open '\response-preview': Unexpected token <."
The parse shouldn't work but is it possible to see the RAW data?
from vscode-restclient.
@Huachao Yes, for me, this issue is no longer present. Thanks!
from vscode-restclient.
@StephD , could you please provide me the raw request that you issued so that I can debug? Thanks in advance
from vscode-restclient.
Check my previous comment.
Here is the answer I get into a browser (as RAW).
Notice: Undefined variable: params in C:\var\www******.php on line 58
{"error":"Nothing has been found"}
This is this tag '
' that made the previous error => Unexpected token <.
from vscode-restclient.
@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?
from vscode-restclient.
It's alright :)
Yes, this is the response body.
Firefox developer own a json viewer : https://developer.mozilla.org/en-US/docs/Tools/JSON_viewer
I used it to render the rest response body into my rest api.
When I made a mistake into my php code, it's display an error code :
Notice: Undefined variable: params in C:\var\www******.php on line 58
(This is an exemple)
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.
Here is the PHP function that allow that : http://php.net/manual/en/function.json-last-error.php
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
tag or "<" token can be parsed into XML.
Notice: Undefined variable: params in C:\var\www******.php on line 58
Nothing has been found
from vscode-restclient.
@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?
from vscode-restclient.
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).
from vscode-restclient.
@StephD, nice suggestion that add a error/warning message as well when displaying raw response. And I will fix it ASAP
from vscode-restclient.
@StephD you can try latest version 0.5.5 π
from vscode-restclient.
Awsome, thanks :)
from vscode-restclient.
Related Issues (20)
- Make it possible to run the request on floating auxiliary windows
- Multi-part requests: user should be able to set content-type for each part in a multi-part request. HOT 3
- Cannot click SEND REQUEST if swapping window HOT 7
- Concatenate variables HOT 1
- Request body in JSON file not working with relative or absolute path HOT 1
- Response extremely slow compared to Postman HOT 1
- Is it possible to not encode a Basic Authorization header?
- Output or Print response or value of variable ( HOT 3
- ζδ»Άε€±ζδΊε¦ HOT 1
- No Send Request link HOT 1
- [VS Code IDE] socket hang up only for http request after upgrade vscode to v1.81 and above
- Warning: The content type of response is application/json, while response body is not a valid json string HOT 1
- add support for default url defined by `@host` for httpyac compatibitlity
- why not support 'DELETE' option. HOT 2
- The gzip-compressed JSON data transmitted by the backend is not available to the variables.
- TLS problem(mybe) with domain in /etc/hosts with traefik
- Please release latest version HOT 1
- πΎ not working for me - details in description HOT 1
- can you support the Jetbrains IDEA environment json file for vscode ?
- Duration in response output window
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-restclient.