- #include "jsonanswer.h"
- #include <QJsonDocument>
- QByteArray JsonAnswer::result() const
- {
- QByteArray objStr = QJsonDocument(m_obj).toJson(QJsonDocument::JsonFormat::Compact);
- QString result = "HTTP/1.1 200 OK\r\nContent-Type: application/json; charset=utf-8\r\n"
- "Content-Length: "+QString::number(objStr.size())+"\r\n\r\n" + objStr;
- return result.toUtf8();
- }
|