QWebEngineHttpRequest Class▲
-
Header: QWebEngineHttpRequest
-
Since: Qt 5.9
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
-
qmake: QT += webenginecore
-
Group: QWebEngineHttpRequest is part of webengine
Detailed Description▲
QWebEngineHttpRequest represents an HTTP request in the WebEngine networking stack. It holds the information necessary to send a request over the network. It contains a URL and some ancillary information that can be used to modify the request. Both QWebEnginePage::load() and QWebEngineView::load() accept a QWebEngineHttpRequest as a parameter.
Member Type Documentation▲
enum QWebEngineHttpRequest::Method▲
This enum type describes the method used to send the HTTP request:
Constant |
Value |
Description |
---|---|---|
0 |
The GET method. |
|
QWebEngineHttpRequest::Post |
1 |
The POST method. |
Member Function Documentation▲
[explicit] QWebEngineHttpRequest::QWebEngineHttpRequest(const QUrl &url = QUrl(), const QWebEngineHttpRequest::Method &method = QWebEngineHttpRequest::Get)▲
Constructs a QWebEngineHttpRequest object with url as the URL to be requested and method as the method to be used.
See Also▲
QWebEngineHttpRequest::QWebEngineHttpRequest(const QWebEngineHttpRequest &other)▲
Creates a copy of other.
QWebEngineHttpRequest::~QWebEngineHttpRequest()▲
Disposes of the QWebEngineHttpRequest object.
bool QWebEngineHttpRequest::hasHeader(const QByteArray &headerName) const▲
Returns true if the header headerName is present in this WebEngine request.
See Also▲
See also setHeader(), header(), unsetHeader(), headers()
QByteArray QWebEngineHttpRequest::header(const QByteArray &headerName) const▲
Returns the header specified by headerName. If no such header is present, an empty QByteArray is returned, which may be indistinguishable from a header that is present but has no content (use hasHeader() to find out if the header exists or not).
Headers can be set with setHeader().
See Also▲
See also setHeader(), hasHeader(), unsetHeader(), headers()
QList<QByteArray> QWebEngineHttpRequest::headers() const▲
Returns a list of all headers that are set in this WebEngine request. The list is in the order that the headers were set.
See Also▲
See also setHeader(), header(), hasHeader(), unsetHeader()
QWebEngineHttpRequest::Method QWebEngineHttpRequest::method() const▲
QByteArray QWebEngineHttpRequest::postData() const▲
[static] QWebEngineHttpRequest QWebEngineHttpRequest::postRequest(const QUrl &url, const QMap<QString, QString> &postData)▲
Constructs a QWebEngineHttpRequest to url that uses the POST method.
postData may contain arbitrary strings. They are translated to appropriate raw data.
See Also▲
See also postData, setPostData()
void QWebEngineHttpRequest::setHeader(const QByteArray &headerName, const QByteArray &headerValue)▲
Sets the header headerName to be of value headerValue.
Setting the same header twice overrides the previous setting. To accomplish the behavior of multiple HTTP headers of the same name, you should concatenate the two values, separating them with a comma (",") and set one single header.
See Also▲
See also header(), hasHeader(), unsetHeader(), headers()
void QWebEngineHttpRequest::setMethod(QWebEngineHttpRequest::Method method)▲
void QWebEngineHttpRequest::setPostData(const QByteArray &postData)▲
Sets the (raw) POST data this WebEngine request contains to be postData.
See Also▲
See also postData()
void QWebEngineHttpRequest::setUrl(const QUrl &url)▲
void QWebEngineHttpRequest::swap(QWebEngineHttpRequest &other)▲
Swaps this WebEngine request with other. This function is very fast and never fails.
void QWebEngineHttpRequest::unsetHeader(const QByteArray &key)▲
Removes the header specified by key, if present.
See Also▲
QUrl QWebEngineHttpRequest::url() const▲
bool QWebEngineHttpRequest::operator!=(const QWebEngineHttpRequest &other) const▲
QWebEngineHttpRequest &QWebEngineHttpRequest::operator=(const QWebEngineHttpRequest &other)▲
Creates a copy of other.
bool QWebEngineHttpRequest::operator==(const QWebEngineHttpRequest &other) const▲
Returns true if this object is the same as other (that is, if they have the same method, URL, and headers).
See Also▲
See also operator!=()