-
Notifications
You must be signed in to change notification settings - Fork 146
Open
Description
long-poll-chat
https://github.com/iliakan/nodejs-screencast/blob/master/long-poll-chat/server.js#L23
в строке где body +=req.read();
req.read() последним значением возвращает null, что приводит к строке, например:
{"message":"привет"}null
и соответственно в строке body = JSON.parse(body); появляется ошибка.
Для того чтобы json был валидным
нужно сделать проверку на null
var req_read = req.read();
if(req_read != null) body += req_read;
Metadata
Metadata
Assignees
Labels
No labels