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.open( "GET", url, true );
|
||||||
http.setRequestHeader( "Authorization:", "Bearer " + props.token );
|
http.setRequestHeader( "Authorization:", "Bearer " + props.token );
|
||||||
|
http.setRequestHeader( "Accept", "application/json" );
|
||||||
|
http.setRequestHeader( "Connection", "close" );
|
||||||
|
|
||||||
http.send();
|
http.send();
|
||||||
}
|
}
|
||||||
|
@ -581,6 +583,8 @@ function _downloadNextArticles( url, token, page, cb )
|
||||||
|
|
||||||
http.open( "GET", pageUrl, true );
|
http.open( "GET", pageUrl, true );
|
||||||
http.setRequestHeader( "Authorization:", "Bearer " + token );
|
http.setRequestHeader( "Authorization:", "Bearer " + token );
|
||||||
|
http.setRequestHeader( "Accept", "application/json" );
|
||||||
|
http.setRequestHeader( "Connection", "close" );
|
||||||
|
|
||||||
http.send();
|
http.send();
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,10 @@ void HttpPatchRequest::start()
|
||||||
|
|
||||||
QNetworkRequest rq( mUrl );
|
QNetworkRequest rq( mUrl );
|
||||||
rq.setRawHeader( QByteArray( "Authorization" ), authHeader );
|
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 );
|
mReply = mQnam.sendCustomRequest( rq, QByteArray( "PATCH" ), mContentIO );
|
||||||
connect( mReply, &QNetworkReply::finished, this, &HttpPatchRequest::onRequestDone );
|
connect( mReply, &QNetworkReply::finished, this, &HttpPatchRequest::onRequestDone );
|
||||||
|
@ -92,6 +96,8 @@ void HttpDeleteRequest::start()
|
||||||
|
|
||||||
QNetworkRequest rq( mUrl );
|
QNetworkRequest rq( mUrl );
|
||||||
rq.setRawHeader( QByteArray( "Authorization" ), authHeader );
|
rq.setRawHeader( QByteArray( "Authorization" ), authHeader );
|
||||||
|
rq.setRawHeader( QByteArray( "Accept" ), QByteArray( "application/json" ) );
|
||||||
|
rq.setRawHeader( QByteArray( "Connection" ), QByteArray( "close" ) );
|
||||||
|
|
||||||
mReply = mQnam.sendCustomRequest( rq, QByteArray( "DELETE" ) );
|
mReply = mQnam.sendCustomRequest( rq, QByteArray( "DELETE" ) );
|
||||||
connect( mReply, &QNetworkReply::finished, this, &HttpDeleteRequest::onRequestDone );
|
connect( mReply, &QNetworkReply::finished, this, &HttpDeleteRequest::onRequestDone );
|
||||||
|
|
Loading…
Reference in New Issue