thunderclient / thunder-client-support

Thunder Client is a lightweight Rest API Client Extension for VS Code.
https://www.thunderclient.com
Other
3.64k stars 131 forks source link

Connection was refused by the server. #170

Closed berkobob closed 3 years ago

berkobob commented 3 years ago

Describe the bug I've written a very simple REST JSON server in Dart using Shelf. I can make requests via a browser or Postman but when using Thunder Client I get "Connection was refused by the server."

To Reproduce http://127.0.0.1:8081/ http://localhost:8081/

Expected behavior I would expect "200 Server running"

Platform:

Solution:

steelvelveteen commented 1 year ago

Thanks rangav, I tried all the possible solutions on this page and none work. Connection Refused

rangav commented 1 year ago

Thanks rangav, I tried all the possible solutions on this page and none work. Connection Refused

Did you try this option?

use localhost:56752 and enbale preview features settings

image

steelvelveteen commented 1 year ago

Yes, I did. Combinations of [::1] , 127.0.0.1, 0.0.0.0 with got, axios, preview features and nothing yet.

rangav commented 1 year ago

what backend application is yours? is it node?

steelvelveteen commented 1 year ago

It's an ASP.NET Core 2.2 application, and it was working until a couple hours ago. All that has changed is that I restarted my computer.

rangav commented 1 year ago

thanks for sharing, will try and see if i can re-produce the issue here.

It's an ASP.NET Core 2.2 application, and it was working until a couple hours ago. All that has changed is that I restarted my computer.

Did you check its not a proxy issue?

steelvelveteen commented 1 year ago

Not sure about that. I am using a VPN, without it there would be no access at all to the api I'm querying. But this hasn't been an issue until today. All queries I have saved in the extension fail, complex, simple queries, all of them.

hungtcs commented 1 year ago

@steelvelveteen Did you check this vscode setting?

image

marifcelik commented 1 year ago

I was facing the same problem. in my case problem solved when I use only port in app.listen function in express app

app.listen(PORT, () => {
    // ...
}) // like this
huncholane commented 1 year ago

If you're using npm edit the dev script to have --host at the end

myleftshoe commented 1 year ago

replacing localhost with [::1] worked for me too http://[::1]:5173/. I don't know where the problem lies but the ability to use `localhost' is needed - especially if yr cutting and pasting

dxps commented 1 year ago

I was resuming evaluating this client and guess what, got into this issue straight away. :facepalm:

Based on the aforementioned ideas, I tried all of these and nothing worked:

Of course, it works:

Context:

Any other ideas, please :grey_question:


:partying_face: UPDATE It worked using [::] as hostname and got client. So my API_URL env var has now the value of http://[::]:8081/api


Here is an example when API_URL env var has the value of http://127.0.0.1:8081 and axios client is used. If got client is used, just the response is different, stating that "Connection was refused by the server". But the Output entries are the same. image

Dfamilia commented 1 year ago
  1. if you are using WSL on Windows use [::1] or [::] instead of localhost in the address bar. Example [::1]:3000/api/v1 .
  2. Another option is to use the PowerShell instead of the WSL terminal.
  3. You can also move your project directory to the Linux file system (~/home)
dxps commented 1 year ago

@Dfamilia Thanks. I'm on Linux, as mentioned before. Moving the project to another location doesn't solve the issue. The solution is to use [::].