Vscode-restclient: Connection is being rejected

Created on 19 Oct 2017  路  19Comments  路  Source: Huachao/vscode-restclient

  • VSCode Version: Version 1.17.2 (1.17.2)
  • OS Version: MacOS Sierra 10.12.4 (16E195)
  • REST Client Version: Latest

Steps to Reproduce:

Try and send request

POST /api HTTP/1.1
Host: testapp.com
Content-Type: application/json
Accept: application/json
Cache-Control: no-cache

{
    "name": "smith"
}
bug

Most helpful comment

Using Windows 10 I had the same issue.

My local server (Lumen) was running on localhost:8080, I set the request as below:

POST http://localhost:8080
content-type: application/json

{
"name": "sample",
"time": "Wed, 21 Oct 2015 18:27:50 GMT"
}

And got the error Connection is being rejected.

I suspect this is not directly related to vscode-restclient but the way how localhost is now handled in Windows 10.

To fix this I just ran my Lumen server as 127.0.0.1:8080 instead of localhost:8080, all worked after that.

Hope this help someone in the future.

All 19 comments

@ben-foster-cko can you succeed without using the Host header, I mean set the full url like http://testapp.com/api. If not, can you succeed with cURL?

Having this simple request:

POST http://localhost:3000 HTTP/1.1
content-type: application/json

{
    "name": "sample",
    "time": "Wed, 21 Oct 2015 18:27:50 GMT"
}

Getting error
Connection is being rejected. The service isn鈥檛 running on the server, or a firewall is blocking requests. Details: Error: connect ECONNREFUSED 8.20.189.133:8080.

All good in case of using curl.

@kuncevic is your web service properly enabled to listen at port 3000?

Whatewer url I am using getting this error, e.g GET http://google.com HTTP/1.1
Running Windows 10
image
If I copy request as curl and than run that in command line - all good.

@kuncevic can you show me you rest client related settings in vscode setting file?

Thanks for pointing that out. I had just wrong http settings. All good now.

@kuncevic NP, glad to hear that.

@ben-foster-cko if you no longer met this issue, I'd like to close this issue. You could reopen it as you wish.

I'm also getting this error in-case of a simple GET request which works well in browser.

Connection is being rejected. The service isn鈥檛 running on the server, or incorrect proxy settings in vscode, or a firewall is blocking requests. Details: Error: connect ECONNREFUSED

@mnrafg do you have proxy setting

No I don't have any proxy settings.

@mnrafg do you meet this case for any request

Using Windows 10 I had the same issue.

My local server (Lumen) was running on localhost:8080, I set the request as below:

POST http://localhost:8080
content-type: application/json

{
"name": "sample",
"time": "Wed, 21 Oct 2015 18:27:50 GMT"
}

And got the error Connection is being rejected.

I suspect this is not directly related to vscode-restclient but the way how localhost is now handled in Windows 10.

To fix this I just ran my Lumen server as 127.0.0.1:8080 instead of localhost:8080, all worked after that.

Hope this help someone in the future.

setting my host to 127.0.0.1 instead of localhost in my laravel server also works, thanks for saving me @MickaelTH

Sending request for
192.168.1.7/debug and getting the same error,
Added http:// and the error is fixed for me
http://192.168.1.7/debug

I had the same problem, but I realized that I have been request the url as a 'string' and you should not.
No quotations and it works.

Hi
I am also getting the below error

Connection is being rejected. The service isn鈥檛 running on the server, or incorrect proxy settings in vscode, or a firewall is blocking requests. Details: RequestError: connect ECONNREFUSED 127.0.0.1:443.

How do i check for rest client related settings in vscode setting file

For people using Express.js, I resolved this issue by specifying the host with app.listen():

app.listen(8080, 'localhost')

It's strange because I had been using REST client for weeks without issues and without specifying localhost.

I'm getting the same behavior with a Lumen server running trough php -S localhost:8000 -t public on Windows 10.
Solved it by using php -S 127.0.0.1:8000 -t public.
Postman had not problems with it. I suspect the underlying node package that sends the request is the culprit because I tried another rest client extension and got errors there as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chewlm86 picture chewlm86  路  13Comments

johnbeynon picture johnbeynon  路  23Comments

akalcik picture akalcik  路  15Comments

OzgurDogan picture OzgurDogan  路  13Comments

heneds picture heneds  路  32Comments