Add various HTTP headers in the outgoing requests
parent
35cd1f8723
commit
f1b45f320a
|
@ -344,6 +344,8 @@ function syncDeletedArticles( timerSource, props, cb )
|
|||
|
||||
http.open( "GET", url, true );
|
||||
http.setRequestHeader( "Authorization:", "Bearer " + props.token );
|
||||
http.setRequestHeader( "Accept", "application/json" );
|
||||
http.setRequestHeader( "Connection", "close" );
|
||||
|
||||
http.send();
|
||||
}
|
||||
|
@ -581,6 +583,8 @@ function _downloadNextArticles( url, token, page, cb )
|
|||
|
||||
http.open( "GET", pageUrl, true );
|
||||
http.setRequestHeader( "Authorization:", "Bearer " + token );
|
||||
http.setRequestHeader( "Accept", "application/json" );
|
||||
http.setRequestHeader( "Connection", "close" );
|
||||
|
||||
http.send();
|
||||
}
|
||||
|
|
|
@ -52,6 +52,10 @@ void HttpPatchRequest::start()
|
|||
|
||||
QNetworkRequest rq( mUrl );
|
||||
rq.setRawHeader( QByteArray( "Authorization" ), authHeader );
|
||||
rq.setRawHeader( QByteArray( "Accept" ), QByteArray( "application/json" ) );
|
||||
rq.setHeader( QNetworkRequest::ContentLengthHeader, mContent.length() );
|
||||
rq.setHeader( QNetworkRequest::ContentTypeHeader, QStringLiteral( "application/json" ) );
|
||||
rq.setRawHeader( QByteArray( "Connection" ), QByteArray( "close" ) );
|
||||
|
||||
mReply = mQnam.sendCustomRequest( rq, QByteArray( "PATCH" ), mContentIO );
|
||||
connect( mReply, &QNetworkReply::finished, this, &HttpPatchRequest::onRequestDone );
|
||||
|
@ -92,6 +96,8 @@ void HttpDeleteRequest::start()
|
|||
|
||||
QNetworkRequest rq( mUrl );
|
||||
rq.setRawHeader( QByteArray( "Authorization" ), authHeader );
|
||||
rq.setRawHeader( QByteArray( "Accept" ), QByteArray( "application/json" ) );
|
||||
rq.setRawHeader( QByteArray( "Connection" ), QByteArray( "close" ) );
|
||||
|
||||
mReply = mQnam.sendCustomRequest( rq, QByteArray( "DELETE" ) );
|
||||
connect( mReply, &QNetworkReply::finished, this, &HttpDeleteRequest::onRequestDone );
|
||||
|
|
Loading…
Reference in New Issue