コード例 #1
0
        public virtual ResponseEnvelope Get(
            string url,
            Dictionary <string, string> headers = null,
            string contentType = "application/json; charset=utf-8")
        {
            _logger.Debug($"HTTP GET on {url}");

            var response = _executor.Do(() => _client.GetAsync(url).Result);

            return(response.ToEnvelope());
        }
コード例 #2
0
        public ResponseEnvelope Get(string url, Dictionary <string, string> headers = null)
        {
            var urlDebug     = $"HTTP GET on {url}";
            var errorContext = BuildErrorContext(urlDebug);

            _logger.Debug(urlDebug);

            // Act
            var response = _executor.Do(() => _httpClient.GetAsync(url).Result, errorContext);

            // Process
            var output = response.ToEnvelope();

            _logger.Trace(output.Body);
            ProcessStatusCodes(output, errorContext);

            return(output);
        }
コード例 #3
0
        public ResponseEnvelope Get(
            string path,
            Dictionary <string, string> headers = null,
            bool excludeVersion = false)
        {
            // Arrange
            var address      = MakeFinalUrl(path, excludeVersion);
            var urlDebug     = $"HTTP GET on {address} (ContextId: {this.ObjectIdentifier})";
            var errorContext = BuildErrorContext(urlDebug);

            _logger.Debug(urlDebug);

            // Act
            var response = _executor.Do(() => _httpClient.GetAsync(address).Result, errorContext);

            // Response
            var output = response.ToEnvelope();

            _logger.Trace(output.Body);

            // Assert
            return(ProcessStatusCodes(output, urlDebug));
        }