Skip to content

Commit 2750992

Browse files
author
Robin Gottfried
committed
fix error when end sent before request
There was situation when the handler receives 'end' message before initial 'header' request. The client was fixed warn and continue instead of crash.
1 parent ff1efe7 commit 2750992

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

client/client.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,12 @@ class Channel extends Object {
157157

158158
on_end() {
159159
debug(` :> ${this.id} end`);
160-
this.request.end();
160+
if (this.request) {
161+
this.request.end();
162+
} else {
163+
warning(`Received end before I was able to create a request.`);
164+
setTimeout(()=>console.log(`Request: ${this.request}`), 100);
165+
}
161166
}
162167

163168
onHttpData(chunk) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "karmen_ws",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "",
55
"main": "client",
66
"scripts": {

0 commit comments

Comments
 (0)