7 #include <Cutelyst/cutelyst_export.h>
8 #include <Cutelyst/headers.h>
10 #include <QtCore/QIODevice>
19 class ResponsePrivate;
36 SwitchingProtocols = 101,
40 NonAuthoritativeInformation = 203,
45 MultipleChoices = 300,
46 MovedPermanently = 301,
51 TemporaryRedirect = 307,
52 PermanentRedirect = 308,
55 PaymentRequired = 402,
58 MethodNotAllowed = 405,
60 ProxyAuthenticationRequired = 407,
65 PreconditionFailed = 412,
66 RequestEntityTooLarge = 413,
67 RequestURITooLong = 414,
68 UnsupportedMediaType = 415,
69 RequestedRangeNotSatisfiable = 416,
70 ExpectationFailed = 417,
71 InternalServerError = 500,
74 ServiceUnavailable = 503,
76 HTTPVersionNotSupported = 505,
77 BandwidthLimitExceeded = 509
83 CloseCodeNormal = 1000,
84 CloseCodeGoingAway = 1001,
85 CloseCodeProtocolError = 1002,
86 CloseCodeDatatypeNotSupported = 1003,
87 CloseCodeReserved1004 = 1004,
88 CloseCodeMissingStatusCode = 1005,
89 CloseCodeAbnormalDisconnection = 1006,
90 CloseCodeWrongDatatype = 1007,
91 CloseCodePolicyViolated = 1008,
92 CloseCodeTooMuchData = 1009,
93 CloseCodeMissingExtension = 1010,
94 CloseCodeBadOperation = 1011,
95 CloseCodeTlsHandshakeFailed = 1015
107 quint16 status() const noexcept;
112 void setStatus(quint16 status) noexcept;
119 bool hasBody() const noexcept;
152 inline
void setBody(const
QString &body);
170 void setCborValueBody(const
QCborValue &value);
196 void setJsonArrayBody(const
QJsonArray &array);
210 void setContentEncoding(const
QByteArray &encoding);
217 qint64 contentLength() const;
224 void setContentLength(qint64 length);
238 void setContentType(const
QByteArray &type) { headers().setContentType(type); }
287 void redirect(
const QUrl &url, quint16 status = Found);
347 bool isFinalizedHeaders() const noexcept;
352 bool isSequential() const noexcept override;
357 qint64 size() const noexcept override;
415 virtual qint64 writeData(
const char *data, qint64 len)
override;
420 virtual qint64 readData(
char *data, qint64 maxlen)
override;
422 ResponsePrivate *d_ptr;
425 friend class EngineConnection;
427 friend class ContextPrivate;
The Cutelyst application.
bool webSocketTextMessage(const QString &message)
bool webSocketPing(const QByteArray &payload={})
void setBody(QIODevice *body)
void redirectSafe(const QUrl &url, const QUrl &fallback)
bool webSocketBinaryMessage(const QByteArray &message)
void redirect(const QString &url, quint16 status=Found)
void setJsonBody(QStringView json)
bool webSocketClose(quint16 code=Response::CloseCodeNormal, const QString &reason={})
QUrl location() const noexcept
The Cutelyst namespace holds all public Cutelyst API.
QByteArray toUtf8() const const
QByteArray toUtf8() const const