7 #include <Cutelyst/Context>
8 #include <Cutelyst/Engine>
9 #include <Cutelyst/Request>
10 #include <Cutelyst/Response>
13 #include <QHostAddress>
14 #include <QHttpMultiPart>
15 #include <QJsonDocument>
16 #include <QLoggingCategory>
17 #include <QNetworkAccessManager>
21 Q_LOGGING_CATEGORY(C_USERAGENT,
"cutelyst.useragent", QtWarningMsg)
32 return m_instance.
head(request);
37 return m_instance.
get(request);
42 return m_instance.
post(request, data);
47 return m_instance.
post(request, data);
52 return m_instance.
put(request, data);
57 return m_instance.
put(request, data);
80 return m_instance.
post(request, multiPart);
85 return m_instance.
post(request, multiPart);
99 QByteArrayLiteral(
"application/json"));
107 QByteArrayLiteral(
"application/json"));
117 QByteArrayLiteral(
"application/json"));
125 QByteArrayLiteral(
"application/json"));
133 QByteArrayLiteral(
"application/json"));
143 QByteArrayLiteral(
"application/json"));
152 QByteArrayLiteral(
"application/json"));
160 QByteArrayLiteral(
"application/json"));
170 QByteArrayLiteral(
"application/json"));
177 QUrl dest(request->uri());
185 const auto headersData = reqHeaders.
data();
186 auto it = headersData.begin();
187 while (it != headersData.end()) {
202 responseHeaders.
pushHeader(pair.first, pair.second);
218 responseHeaders.
pushHeader(pair.first, pair.second);
void detachAsync() noexcept
Response * response() const noexcept
Headers headers() const noexcept
QIODevice * body() const noexcept
void setBody(QIODevice *body)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * sendCustomRequestJsonObject(const QNetworkRequest &request, const QByteArray &verb, const QJsonObject &object)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * putJson(const QNetworkRequest &request, const QJsonDocument &doc)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QIODevice *data=nullptr)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * forwardRequestResponse(Context *c, const QUrl &destination)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * postJsonArray(const QNetworkRequest &request, const QJsonArray &array)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * head(const QNetworkRequest &request)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * get(const QNetworkRequest &request)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * forwardRequest(Request *request, const QUrl &destination)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * postJsonObject(const QNetworkRequest &request, const QJsonObject &object)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * putJsonArray(const QNetworkRequest &request, const QJsonArray &array)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkAccessManager * networkAccessManager()
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * sendCustomRequestJson(const QNetworkRequest &request, const QByteArray &verb, const QJsonDocument &doc)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * put(const QNetworkRequest &request, QIODevice *data)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * postJson(const QNetworkRequest &request, const QJsonDocument &doc)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * deleteResource(const QNetworkRequest &request)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * post(const QNetworkRequest &request, QIODevice *data)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * sendCustomRequestJsonArray(const QNetworkRequest &request, const QByteArray &verb, const QJsonArray &array)
CUTELYST_PLUGIN_USERAGENT_EXPORT QNetworkReply * putJsonObject(const QNetworkRequest &request, const QJsonObject &object)
CUTELYST_PLUGIN_USERAGENT_EXPORT void forwardAsync(Context *c, const QUrl &destination)
The Cutelyst namespace holds all public Cutelyst API.
QByteArray toJson(QJsonDocument::JsonFormat format) const const
QNetworkReply * deleteResource(const QNetworkRequest &request)
QNetworkReply * get(const QNetworkRequest &request)
QNetworkReply * head(const QNetworkRequest &request)
QNetworkReply * post(const QNetworkRequest &request, QHttpMultiPart *multiPart)
QNetworkReply * put(const QNetworkRequest &request, QHttpMultiPart *multiPart)
QNetworkReply * sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QHttpMultiPart *multiPart)
QVariant attribute(QNetworkRequest::Attribute code) const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QString host(QUrl::ComponentFormattingOptions options) const const
int port(int defaultPort) const const
QString scheme() const const
void setHost(const QString &host, QUrl::ParsingMode mode)
void setScheme(const QString &scheme)
uint toUInt(bool *ok) const const