Move JSON output functionality to socket.

This commit is contained in:
Nathan Osman
2016-10-14 14:14:06 -07:00
parent 4dd17ad4ea
commit f059e9bc66
5 changed files with 18 additions and 15 deletions

View File

@@ -90,15 +90,6 @@ bool QObjectHandler::readJson(QHttpSocket *socket, QJsonDocument &document)
return true;
}
void QObjectHandler::writeJson(QHttpSocket *socket, const QJsonDocument &document)
{
QByteArray data = document.toJson();
socket->setHeader("Content-Length", QByteArray::number(data.length()));
socket->setHeader("Content-Type", "application/json");
socket->write(data);
socket->close();
}
void QObjectHandler::process(QHttpSocket *socket, const QString &path)
{
// Ensure the method has been registered