Skip to content

Commit 9c9e503

Browse files
authored
Merge pull request #8 from oxygens/master
Small things.
2 parents c6a80dc + f45c3be commit 9c9e503

File tree

5 files changed

+37
-30
lines changed

5 files changed

+37
-30
lines changed

builds/browser/es5/jsonrpc.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"name": "jsonrpc-bidirectional",
33
"description": "Bidirectional JSONRPC over web sockets or HTTP with extensive plugin support.",
4-
"version": "2.4.1",
4+
"version": "2.4.5",
55
"scripts": {
66
"build": "node build.js",
77
"test": "node tests/main.js",
88
"lint": "eslint src tests --quiet"
99
},
1010
"repository": {
1111
"type": "git",
12-
"url": "git+https://github.com/bigstepinc/jsonrpc-bidirectional.git"
12+
"url": "git+https://github.com/oxygens/jsonrpc-bidirectional.git"
1313
},
14-
"homepage": "https://github.com/bigstepinc/jsonrpc-bidirectional",
14+
"homepage": "https://github.com/oxygens/jsonrpc-bidirectional",
1515
"author": "Ionut Stan <[email protected]>",
1616
"license": "MIT",
1717
"contributors": [
@@ -41,24 +41,21 @@
4141
"ws": "^2.2.3"
4242
},
4343
"devDependencies": {
44-
"@types/node": "*",
45-
"babel-core": "*",
46-
"babel-eslint": "*",
47-
"babel-loader": "*",
48-
"babel-plugin-async-to-promises": "*",
49-
"babel-plugin-remove-comments": "*",
50-
"babel-polyfill": "*",
51-
"babel-preset-es2015": "*",
52-
"babel-preset-stage-3": "*",
53-
"babel-runtime": "*",
54-
"eslint": "*",
55-
"eslint-plugin-jsdoc": "*",
44+
"@types/node": "^7.0.13",
45+
"babel-core": "^6.24.1",
46+
"babel-eslint": "^7.2.2",
47+
"babel-loader": "^6.4.1",
48+
"babel-plugin-async-to-promises": "^1.0.5",
49+
"babel-plugin-remove-comments": "^2.0.0",
50+
"babel-polyfill": "^6.23.0",
51+
"babel-preset-es2015": "^6.24.1",
52+
"babel-preset-stage-3": "^6.24.1",
53+
"babel-runtime": "^6.23.0",
54+
"eslint": "^3.19.0",
55+
"eslint-plugin-jsdoc": "^3.0.2",
5656
"phantom": "^4.0.2",
57-
"webpack": "*",
58-
"sleep-promise": "*"
59-
},
60-
"optionalDependencies": {
61-
"bufferutil": "^3.0.0",
62-
"utf-8-validate": "^3.0.1"
57+
"sleep-promise": "^2.0.0",
58+
"uglify-js": "^2.8.22",
59+
"webpack": "^2.4.1"
6360
}
6461
}

tests/AllTests.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class AllTests
7676
this._serverAuthorizeAllPlugin = new JSONRPC.Plugins.Server.AuthorizeAll();
7777

7878
this._bWebSocketMode = !!bWebSocketMode;
79+
this._bPreventHTTPAPIRequests = false;
7980

8081
Object.seal(this);
8182
}
@@ -86,6 +87,9 @@ class AllTests
8687
*/
8788
async runTests()
8889
{
90+
this._bPreventHTTPAPIRequests = this._bWebSocketMode;
91+
92+
8993
await this.triggerConnectionRefused();
9094

9195

@@ -179,6 +183,9 @@ class AllTests
179183

180184
this._httpServerSiteA = null;
181185
}
186+
187+
188+
this._bPreventHTTPAPIRequests = false;
182189
}
183190

184191

@@ -233,7 +240,7 @@ class AllTests
233240
return;
234241
}
235242
else if(
236-
this._bWebSocketMode
243+
this._bPreventHTTPAPIRequests
237244
&& !incomingRequest.headers["sec-websocket-version"]
238245
&& incomingRequest.method === "POST"
239246
&& url.parse(incomingRequest.url).pathname.substr(0, 4) === "/api"
@@ -510,8 +517,7 @@ class AllTests
510517
*/
511518
async endpointNotFoundError()
512519
{
513-
const bWebSocketMode = this._bWebSocketMode;
514-
this._bWebSocketMode = false;
520+
this._bPreventHTTPAPIRequests = false;
515521

516522

517523
console.log("[" + process.pid + "] endpointNotFoundError");
@@ -538,7 +544,7 @@ class AllTests
538544
}
539545

540546

541-
this._bWebSocketMode = bWebSocketMode;
547+
this._bPreventHTTPAPIRequests = this._bWebSocketMode;
542548
}
543549

544550

tests/Browser/main_server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ process.on(
2020
await allTests.setupWebsocketServerSiteA();
2121
await allTests.disableServerSecuritySiteA();
2222

23-
console.log("Go to http://localhost:8324/tests/Browser/index.html");
23+
console.log("Go to http://localhost:8324/tests/Browser/index.html?websocketmode=1");
2424
}
2525
)();

webpack.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ module.exports = [
5151
new webpack.optimize.UglifyJsPlugin({
5252
minimize: true,
5353
sourceMap: true,
54-
compress: { screw_ie8: true },
54+
compress: {
55+
screw_ie8: true,
56+
unused: true,
57+
dead_code: true
58+
},
5559
mangle: {
5660
screw_ie8: true,
5761
except: recursiveKeys.dumpKeysRecursively(require("./index_webpack")).map(

0 commit comments

Comments
 (0)