| 1 | // Copyright (C) 2019 Mikhail Svetkin <mikhail.svetkin@gmail.com> |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #include "qhttpserverliterals_p.h" |
| 5 | |
| 6 | #include <QtCore/qbytearray.h> |
| 7 | |
| 8 | QT_BEGIN_NAMESPACE |
| 9 | |
| 10 | // Don't use QByteArrayLiteral, as this library may be unloaded before all |
| 11 | // references to the data are destroyed - by allocating on the heap, the last |
| 12 | // user will free the data instead of referencing unloaded data |
| 13 | |
| 14 | QByteArray QHttpServerLiterals::contentTypeXEmpty() |
| 15 | { |
| 16 | static QByteArray ba("application/x-empty" ); |
| 17 | return ba; |
| 18 | } |
| 19 | |
| 20 | QByteArray QHttpServerLiterals::contentTypeTextHtml() |
| 21 | { |
| 22 | static QByteArray ba("text/html" ); |
| 23 | return ba; |
| 24 | } |
| 25 | |
| 26 | QByteArray QHttpServerLiterals::contentTypeJson() |
| 27 | { |
| 28 | static QByteArray ba("application/json" ); |
| 29 | return ba; |
| 30 | } |
| 31 | |
| 32 | QT_END_NAMESPACE |
| 33 | |