reworked graph uri query string param generation

This commit is contained in:
Austin Diviness 2016-10-19 12:17:48 -07:00
Родитель ca479109f8
Коммит 8b7fa51b37
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -73,17 +73,17 @@ Windows::Foundation::Uri^ GraphUriBuilder::MakeUri()
_host = static_cast<String^>(_queryParams->Lookup(L"request_host"));
}
String^ fullPath = _scheme + L"://" + _host + L"/" + _apiVersion + _path;
if (_queryParams->Size > 0)
{
fullPath += L"?";
while (_queryParams->Size > 1)
{
auto it = _queryParams->First();
fullPath += Uri::EscapeComponent(it->Current->Key) + L"=" + Uri::EscapeComponent(static_cast<String^>(it->Current->Value)) + L"&";
_queryParams->Remove(it->Current->Key);
}
String^ separator = L"?";
auto it = _queryParams->First();
fullPath += Uri::EscapeComponent(it->Current->Key) + L"=" + Uri::EscapeComponent(static_cast<String^>(it->Current->Value));
while (it->HasCurrent)
{
fullPath += separator + Uri::EscapeComponent(it->Current->Key) + L"=" + Uri::EscapeComponent(static_cast<String^>(it->Current->Value));
separator = L"&";
it->MoveNext();
}
}
return ref new Uri(fullPath);
}