summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkrequestfactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/access/qnetworkrequestfactory.cpp')
-rw-r--r--src/network/access/qnetworkrequestfactory.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/network/access/qnetworkrequestfactory.cpp b/src/network/access/qnetworkrequestfactory.cpp
index 87738d9086..2a6938bb7f 100644
--- a/src/network/access/qnetworkrequestfactory.cpp
+++ b/src/network/access/qnetworkrequestfactory.cpp
@@ -28,8 +28,6 @@ Q_LOGGING_CATEGORY(lcQrequestfactory, "qt.network.access.request.factory")
\brief Convenience class for grouping remote server endpoints that share
common network request properties.
- \preliminary
-
REST servers often have endpoints that require the same headers and other data.
Grouping such endpoints with a QNetworkRequestFactory makes it more
convenient to issue requests to these endpoints; only the typically
@@ -615,17 +613,11 @@ QNetworkRequest QNetworkRequestFactoryPrivate::newRequest(const QUrl &url) const
if (!sslConfig.isNull())
request.setSslConfiguration(sslConfig);
#endif
- // Set the header entries to the request. Combine values as there
- // may be multiple values per name. Note: this would not necessarily
- // produce right result for 'Set-Cookie' header if it has multiple values,
- // but since it is a purely server-side (response) header, not relevant here.
- const auto headerNames = headers.toMultiMap().uniqueKeys(); // ### fixme: port QNR to QHH
- for (const auto &name : headerNames)
- request.setRawHeader(name, headers.combinedValue(name));
-
+ auto h = headers;
constexpr char Bearer[] = "Bearer ";
if (!bearerToken.isEmpty())
- request.setRawHeader("Authorization"_ba, Bearer + bearerToken);
+ h.replaceOrAppend(QHttpHeaders::WellKnownHeader::Authorization, Bearer + bearerToken);
+ request.setHeaders(std::move(h));
request.setTransferTimeout(transferTimeout);
request.setPriority(priority);