17 #include <QNetworkReply> 20 : mError( reply->error() )
21 , mErrorString( reply->errorString() )
22 , mRawHeaderPairs( reply->rawHeaderPairs() )
23 , mRequest( reply->request() )
25 int maxAttribute =
static_cast< int >( QNetworkRequest::RedirectPolicyAttribute );
26 #if QT_VERSION >= QT_VERSION_CHECK( 5, 11, 0 ) 27 maxAttribute =
static_cast< int >( QNetworkRequest::Http2DirectAttribute );
29 for (
int i = 0; i <= maxAttribute; ++i )
31 if ( reply->attribute( static_cast< QNetworkRequest::Attribute>( i ) ).isValid() )
32 mAttributes[ static_cast< QNetworkRequest::Attribute>( i ) ] = reply->attribute( static_cast< QNetworkRequest::Attribute>( i ) );
36 int requestId = reply->property(
"requestId" ).toInt( &ok );
48 return mAttributes.value( code );
53 for (
auto &header : mRawHeaderPairs )
55 if ( header.first == headerName )
63 QList< QByteArray > res;
64 res.reserve( mRawHeaderPairs.length() );
65 for (
auto &header : mRawHeaderPairs )
74 for (
auto &header : mRawHeaderPairs )
76 if ( header.first == headerName )
QgsNetworkReplyContent()=default
Default constructor for an empty reply.
int requestId() const
Returns the unique ID identifying the original request which this response was formed from...
bool hasRawHeader(const QByteArray &headerName) const
Returns true if the reply contains a header with the specified headerName.
QList< QByteArray > rawHeaderList() const
Returns a list of raw header names contained within the reply.
QVariant attribute(QNetworkRequest::Attribute code) const
Returns the attribute associated with the code.
QByteArray rawHeader(const QByteArray &headerName) const
Returns the content of the header with the specified headerName, or an empty QByteArray if the specif...
void clear()
Clears the reply, resetting it back to a default, empty reply.