Giter Site home page Giter Site logo

Comments (21)

Huachao avatar Huachao commented on May 5, 2024 1

@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.

Huachao avatar Huachao commented on May 5, 2024

@StephD, could you please the error sample in more details, is the '<' in response header, or body?

from vscode-restclient.

bogdan-d avatar bogdan-d commented on May 5, 2024

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.

Huachao avatar Huachao commented on May 5, 2024

@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.

bogdan-d avatar bogdan-d commented on May 5, 2024

I made a gif with the bug:

rest-bug

from vscode-restclient.

Huachao avatar Huachao commented on May 5, 2024

@lypscan, I can't view your image

from vscode-restclient.

bogdan-d avatar bogdan-d commented on May 5, 2024

Steps to reproduce:

  1. save a file with the rest extension (test.rest)
  2. do a GET http://example.com HTTP/1.1
  3. close the response-view pane
  4. now change the domain to google.com (GET http://google.com HTTP/1.1)
  5. 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.

StephD avatar StephD commented on May 5, 2024

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.
2016-07-13 09_10_52- untitled-1 - gateway - visual studio code

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.
2016-07-13 09_07_28-http___gateway local cine intra_rest_bypass_auth yes method getcrmsrbyid sr_id 3
2016-07-13 09_07_43-http___gateway local cine intra_rest_bypass_auth yes method getcrmsrbyid sr_id 3

from vscode-restclient.

bogdan-d avatar bogdan-d commented on May 5, 2024

@Huachao, this bug was not present before the updates (of VSCode 1.3.1 and REST-Client 0.5.3)

from vscode-restclient.

Huachao avatar Huachao commented on May 5, 2024

@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.

StephD avatar StephD commented on May 5, 2024

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.

bogdan-d avatar bogdan-d commented on May 5, 2024

@Huachao Yes, for me, this issue is no longer present. Thanks!

from vscode-restclient.

Huachao avatar Huachao commented on May 5, 2024

@StephD , could you please provide me the raw request that you issued so that I can debug? Thanks in advance

from vscode-restclient.

StephD avatar StephD commented on May 5, 2024

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.

Huachao avatar Huachao commented on May 5, 2024

@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.

StephD avatar StephD commented on May 5, 2024

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.

Huachao avatar Huachao commented on May 5, 2024

@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.

StephD avatar StephD commented on May 5, 2024

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.

Huachao avatar Huachao commented on May 5, 2024

@StephD, nice suggestion that add a error/warning message as well when displaying raw response. And I will fix it ASAP

from vscode-restclient.

Huachao avatar Huachao commented on May 5, 2024

@StephD you can try latest version 0.5.5 πŸ˜…

from vscode-restclient.

StephD avatar StephD commented on May 5, 2024

Awsome, thanks :)

from vscode-restclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.