Exemplo n.º 1
0
        public async Task <HttpResponseMessage> GetResponseAsync()
        {
            if (!_webRequest.SafeHttpMethod())
            {
                if (_internetConnectivity.IsConnected)
                {
                    var response = await _webRequest.GetResponseAsync().ConfigureAwait(false);

                    return(response);
                }
                else
                {
                    var requestData = new RequestData(_webRequest);

                    await _webCache.PutRequestAsync(requestData).ConfigureAwait(false);

                    return(new HttpResponseMessage(HttpStatusCode.Accepted)
                    {
                        Content = new StringContent("{}"),
                    });
                }
            }
            else
            {
                var response = await _webRequest.GetResponseAsync().ConfigureAwait(false);

                return(response);
            }
        }