23#include <QtWebEngineWidgetsVersion>
36 m_job->fail(QWebEngineUrlRequestJob::Error(error));
44 return m_job->redirect(QUrl::fromEncoded(urlString.toUtf8()));
52 if (!map.contains(
QSL(
"content")) || !map.contains(
QSL(
"contentType"))) {
53 qWarning() <<
"Unable to call" << __FUNCTION__ <<
": invalid parameters";
56 QByteArray content = map.value(
QSL(
"content")).toString().toUtf8();
57 QByteArray contentType = map.value(
QSL(
"contentType")).toString().toUtf8();
58 auto *buffer =
new QBuffer();
59 buffer->open(QIODevice::ReadWrite);
60 buffer->write(content);
62 m_job->reply(contentType, buffer);
69 QString initiatorString;
70 initiatorString = QString::fromUtf8(m_job->initiator().toEncoded());
71 return initiatorString;
79 return QString::fromUtf8(m_job->requestUrl().toEncoded());
87 return QString::fromUtf8(m_job->requestMethod());
QString requestUrl
request url of the QWebEngineUrlRequestJob
Q_INVOKABLE void redirect(const QString &urlString)
Redirects the request to the url.
QmlWebEngineUrlRequestJob(QWebEngineUrlRequestJob *job=nullptr, QObject *parent=nullptr)
QString requestMethod
request method of the QWebEngineUrlRequestJob
Q_INVOKABLE void fail(QmlWebEngineUrlRequestJob::Error error)
Fails the request with the error.
Q_INVOKABLE void reply(const QVariantMap &map)
Replies to the request.
Error
The Error enum, exposes QWebEngineUrlRequestJob::Error to QML.
QString initiator
initiator of the QWebEngineUrlRequestJob