Skip to content

Commit bd00140

Browse files
committed
fix: send accurate user agent on all transports
1 parent e36cd1e commit bd00140

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/uapi/Client.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ inline std::string Client::queryHeaderValue(HINTERNET hRequest, const wchar_t* h
11251125
}
11261126

11271127
inline std::string Client::sendWinHttp(const std::string& method, const std::string& pathAndQuery, const std::string& body) const {
1128-
auto hSession = WinHttpOpen(L"uapi-sdk-cpp/0.1.2", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
1128+
auto hSession = WinHttpOpen(L"uapi-sdk-cpp/0.1.13", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
11291129
if (!hSession) throw std::runtime_error("WinHttpOpen failed");
11301130
auto closeSession = [&]() { if (hSession) WinHttpCloseHandle(hSession); hSession = nullptr; };
11311131
std::string result;
@@ -1199,7 +1199,7 @@ inline std::string Client::shellEscape(const std::string& value) {
11991199
}
12001200

12011201
inline std::string Client::sendCurl(const std::string& method, const std::string& absoluteUrl, const std::string& body) const {
1202-
std::string cmd = "curl -s -S -D - -w \"\\n%{http_code}\" -X " + method + " " + shellEscape(absoluteUrl) + " -H \"Accept: application/json\"";
1202+
std::string cmd = "curl -s -S -D - -w \"\\n%{http_code}\" -X " + method + " " + shellEscape(absoluteUrl) + " -A " + shellEscape("uapi-sdk-cpp/0.1.13") + " -H \"Accept: application/json\"";
12031203
if (!token.empty()) cmd += " -H " + shellEscape("Authorization: Bearer " + token);
12041204
if (!body.empty()) {
12051205
cmd += " -H \"Content-Type: application/json\"";

0 commit comments

Comments
 (0)