public async Task <string> GetLoadHtml(string link)
        {
            var httpProvider = new HttpProvider(link);
            var data         = await httpProvider.GetAsync();

            return(data);
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
        //[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();
        }
Пример #4
0
        public async Task <ProfileResponse> GetProfileById(int id)
        {
            var response = await _http.GetAsync <ProfileResponse>($"api/users/profile/{id}");

            return(response);
        }