/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/csharp/csharp-505-161-006/main.cs
25 строк
674 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
using System; using System.Net.Http; using System.Threading.Tasks; class SimpleClient { static async Task Main() { using HttpClient client = new HttpClient(); string url = "http://localhost:8080/test"; try { HttpResponseMessage response = await client.GetAsync(url); response.EnsureSuccessStatusCode(); string body = await response.Content.ReadAsStringAsync(); Console.WriteLine($"Ответ сервера: {body}"); } catch (HttpRequestException e) { Console.WriteLine($"Ошибка запроса: {e.Message}"); } } }