Browse Source

configuratable http port for editor server

Geequlim 8 years ago
parent
commit
2419fc4d33
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/request.ts

+ 5 - 3
src/request.ts

@@ -1,18 +1,20 @@
 import * as http from 'http';
 import * as http from 'http';
+import * as vscode from 'vscode';
 
 
 function requestGodot(body : Object) {
 function requestGodot(body : Object) {
     let postString = JSON.stringify(body);
     let postString = JSON.stringify(body);
+    const port = vscode.workspace.getConfiguration("GodotTools").get("editorServerPort", 6996);
     const options = {
     const options = {
         hostname: '127.0.0.1',
         hostname: '127.0.0.1',
-        port: 6996,
         method: 'POST',
         method: 'POST',
+        port,
+        body,
         headers: {
         headers: {
             "Accept": "application/json",
             "Accept": "application/json",
             "Connection": "keep-alive",
             "Connection": "keep-alive",
             "Content-Type": "application/json",
             "Content-Type": "application/json",
             "Content-Length": Buffer.byteLength(postString)
             "Content-Length": Buffer.byteLength(postString)
-        },
-        body
+        }
     };
     };
     let promise = new Promise((resolve, reject) => {
     let promise = new Promise((resolve, reject) => {
         var req = http.request(options, (res) => {
         var req = http.request(options, (res) => {