Z:\Documents\WebServer\relay\listener>node listener.js
request accepted: POST on /devhttpcon
TypeError: Cannot read property 'flowing' of undefined
at IncomingMessage.Readable.on (_stream_readable.js:776:29)
at Server.https.createRelayedServer (Z:\Documents\WebServer\relay\listener\listener.js:19:8)
at emitTwo (events.js:126:13)
at Server.emit (events.js:214:7)
at requestChannelRequest (Z:\Documents\WebServer\relay\node_modules\hyco-https\lib\HybridConnectionHttpsServer.js:622:12)
at WebSocket.requestChannel.onmessage (Z:\Documents\WebServer\relay\node_modules\hyco-https\lib\HybridConnectionHttpsServer.js:634:7)
at WebSocket.onMessage (Z:\Documents\WebServer\relay\node_modules\ws\lib\event-target.js:120:16)
at emitOne (events.js:116:13)
at WebSocket.emit (events.js:211:7)
at Receiver.receiverOnMessage (Z:\Documents\WebServer\relay\node_modules\ws\lib\websocket.js:720:20)
Here is the code
var uri = https.createRelayListenUri(ns, path);
var server = https.createRelayedServer(
{
server : uri,
token : () => https.createRelayToken(uri, keyrule, key)
}, (req, res) => {
console.log('request accepted: ' + req.method + ' on ' + req.url);
if (req.method === 'POST') {
var body = '';
req.on('data', function(data){
console.log(data);
body += data;
});
req.on('end', function() {
console.log(body);
});
} else {
}
res.setHeader('Content-Type', 'text/html');
res.end('Hello');
}
);
server.listen( (err) => {
if (err) {
return console.log('something bad happened', err)
}
console.log('server is listening on ${port}')
});
Actual Behavior
Here is the code
var uri = https.createRelayListenUri(ns, path); var server = https.createRelayedServer( { server : uri, token : () => https.createRelayToken(uri, keyrule, key) }, (req, res) => { console.log('request accepted: ' + req.method + ' on ' + req.url); if (req.method === 'POST') { var body = ''; req.on('data', function(data){ console.log(data); body += data; }); req.on('end', function() { console.log(body); }); } else { } res.setHeader('Content-Type', 'text/html'); res.end('Hello'); } );
server.listen( (err) => { if (err) { return console.log('something bad happened', err) } console.log('server is listening on ${port}') });
server.on('error', (err) => { console.log('error: ' + err); });
Versions