Add a function in NetworkCommon parseHeaderList which parses a header list as a string into a vector of header pairs (#2623)
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include <QString>
|
||||
|
||||
class QNetworkReply;
|
||||
|
||||
@@ -22,4 +25,13 @@ enum class NetworkRequestType {
|
||||
Patch,
|
||||
};
|
||||
|
||||
// parseHeaderList takes a list of headers in string form,
|
||||
// where each header pair is separated by semicolons (;) and the header name and value is divided by a colon (:)
|
||||
//
|
||||
// We return a vector of pairs, where the first value is the header name and the second value is the header value
|
||||
//
|
||||
// e.g. "Authorization:secretkey;NextHeader:boo" will return [{"Authorization", "secretkey"}, {"NextHeader", "boo"}]
|
||||
std::vector<std::pair<QByteArray, QByteArray>> parseHeaderList(
|
||||
const QString &headerListString);
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user