public async Task <string> GetLoadHtml(string link) { var httpProvider = new HttpProvider(link); var data = await httpProvider.GetAsync(); return(data); }
public async Task <IActionResult> Get() { try { var values = await _httpProvider.GetAsync <IEnumerable <WeatherForecast> >(Url); Debug.WriteLine("[App]: successful"); return(Ok(values)); } catch (Exception e) { Debug.WriteLine("[App]: Failed - " + e.Message); throw; } }
//[Fact] public async Task Blub() { var client = new HttpProvider("https://jsonplaceholder.typicode.com", ImmutableSession.Empty); var response = await client.GetAsync ( "posts/1", ImmutableSession .Empty .Set(Use <IHttpNamespace> .Namespace, x => x.ConfigureRequestHeaders, headers => headers.AcceptJson()) //.ResponseFormatters(ne()) //.ResponseType(typeof(string)) ); var content = await response.DeserializeTextAsync(); }
public async Task <ProfileResponse> GetProfileById(int id) { var response = await _http.GetAsync <ProfileResponse>($"api/users/profile/{id}"); return(response); }