public async Task <(ResponseMessage ResponseMessage, IMapping Mapping)> SendAsync( [NotNull] IProxyAndRecordSettings proxyAndRecordSettings, [NotNull] HttpClient client, [NotNull] RequestMessage requestMessage, [NotNull] string url) { Check.NotNull(client, nameof(client)); Check.NotNull(requestMessage, nameof(requestMessage)); Check.NotNull(url, nameof(url)); var originalUri = new Uri(requestMessage.Url); var requiredUri = new Uri(url); // Create HttpRequestMessage var httpRequestMessage = HttpRequestMessageHelper.Create(requestMessage, url); // Call the URL var httpResponseMessage = await client.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead); // Create ResponseMessage bool deserializeJson = !_settings.DisableJsonBodyParsing.GetValueOrDefault(false); bool decompressGzipAndDeflate = !_settings.DisableRequestBodyDecompressing.GetValueOrDefault(false); var responseMessage = await HttpResponseMessageHelper.CreateAsync(httpResponseMessage, requiredUri, originalUri, deserializeJson, decompressGzipAndDeflate); IMapping mapping = null; if (HttpStatusRangeParser.IsMatch(proxyAndRecordSettings.SaveMappingForStatusCodePattern, responseMessage.StatusCode) && (proxyAndRecordSettings.SaveMapping || proxyAndRecordSettings.SaveMappingToFile)) { mapping = ToMapping(proxyAndRecordSettings, requestMessage, responseMessage); } return(responseMessage, mapping); }