private static async Task <HttpResponseMessage> ExecuteRequest(HttpContext context, string ip, PathString path, HttpClient httpClient, HttpResponseMessage response) { string url = MakeUrl(context, ip, path); HttpRequestMessage request = new HttpRequestMessage(new HttpMethod(context.Request.Method), url); request.Content = await context.Request.MapContent(); httpClient.AddAuthorizationHeaderIfExistsOnRequest(context); response = httpClient.SendAsync(request).GetAwaiter().GetResult(); if (!response.ReasonPhrase.ToLower().Contains("bad request")) { response.EnsureSuccessStatusCode(); } await PrepareResponse(context, response); return(response); }