Use UriBuilder to create request uri

This commit is contained in:
Serghei Cebotari 2023-11-02 23:31:17 +03:00
parent 4bc663c2ab
commit 6d6e91867c

View File

@ -54,7 +54,11 @@ public class DatabaseClient : IDatabaseClient
else else
{ {
string request = @"https://rh.cebotari.ru/api/search?query=" + line; UriBuilder builder = new(@"https://rh.cebotari.ru/api/search")
{
Query = $"query={line.Replace("&", "%26")}"
};
string request = builder.Uri.AbsoluteUri;
if (!_memoryCache.TryGetValue(line, out IEnumerable<Product> products)) if (!_memoryCache.TryGetValue(line, out IEnumerable<Product> products))
{ {