HttpRequest: Don't reorder parameters. (#73)

Also now allows duplicate parameters (which is needed for some use cases).
This commit is contained in:
Peter Johnson
2018-03-01 20:01:11 -08:00
committed by GitHub
parent febc41c85d
commit 71d06a1a20

View File

@@ -13,11 +13,11 @@ namespace wpi {
template <typename T>
HttpRequest::HttpRequest(const HttpLocation& loc, const T& extraParams)
: host{loc.host}, port{loc.port} {
llvm::StringMap<llvm::StringRef> params;
llvm::SmallVector<std::pair<llvm::StringRef, llvm::StringRef>, 8> params;
for (const auto& p : loc.params)
params.insert(std::make_pair(GetFirst(p), GetSecond(p)));
params.emplace_back(std::make_pair(GetFirst(p), GetSecond(p)));
for (const auto& p : extraParams)
params.insert(std::make_pair(GetFirst(p), GetSecond(p)));
params.emplace_back(std::make_pair(GetFirst(p), GetSecond(p)));
SetPath(loc.path, params);
SetAuth(loc);
}