REST client proxy issue in VScode

Viewed 5937

When using the REST client extension in VSCode eg.

Send Request
GET http://localhost:4200/dashboard

###

I get following error :

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

How can I change my http-proxy to 4200 instead of 127.0.0.1:4200 ?

1 Answers

The solution that works for me, it's to change the server hostname with a string (hostname: "127.0.0.1").

Deno/TS/Rest client Extension vscode

app.ts

import { Drash } from "https://deno.land/x/drash@v1.4.3/mod.ts";
import { Api } from "./api.ts";

const server = new Drash.Http.Server({
  response_output: "application/json",
  resources: [Api],
});

server.run({
  hostname: "127.0.0.1", // Just here !
  port: 1854,
});

console.log("Server running...");

api.ts

// @ts-ignore
import { Drash } from "https://deno.land/x/drash@v1.4.3/mod.ts";

export class Api extends Drash.Http.Resource {
  static paths = ["/"];
  public GET() {
    this.response.body = `Hello World! (on ${new Date()})`;
    return this.response;
  }
}

req.http

GET http://localhost:1854/ HTTP/1.1

OR

GET http://127.0.0.1:1854/ HTTP/1.1
Related