File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ void BaseJob::setApiEndpoint(const QString& apiEndpoint)
128
128
d->apiEndpoint = apiEndpoint;
129
129
}
130
130
131
- const BaseJob::headers_t &BaseJob::requestHeaders () const
131
+ const BaseJob::headers_t & BaseJob::requestHeaders () const
132
132
{
133
133
return d->requestHeaders ;
134
134
}
@@ -197,6 +197,10 @@ void BaseJob::Private::sendRequest(bool inBackground)
197
197
{ makeRequestUrl (connection->baseUrl (), apiEndpoint, requestQuery) };
198
198
if (!requestHeaders.contains (" Content-Type" ))
199
199
req.setHeader (QNetworkRequest::ContentTypeHeader, " application/json" );
200
+ if (!expectedContentTypes.isEmpty () &&
201
+ (expectedContentTypes.size () != 1 ||
202
+ expectedContentTypes.front () == " application/json" ))
203
+ req.setRawHeader (" Accept" , expectedContentTypes.join (' ;' ));
200
204
req.setRawHeader (" Authorization" ,
201
205
QByteArray (" Bearer " ) + connection->accessToken ());
202
206
req.setAttribute (QNetworkRequest::BackgroundRequestAttribute, inBackground);
You can’t perform that action at this time.
0 commit comments