Updated response to check if there needs to be [] added to ensure JSON validity

This commit is contained in:
Josh Sherman 2011-09-02 01:32:54 -04:00
parent 3edb0d4548
commit 88dca3688e

View file

@ -103,7 +103,14 @@ http.createServer(function(request, response)
} }
} }
response.end(payload.replace('{{', '[{').replace('}}', '}]')); payload = payload.replace('{{', '[{').replace('}}', '}]');
if (payload.charAt(0) != '[')
{
payload = '[' + payload + ']';
}
response.end(payload + '\n');
} }
}); });