Exemplo n.º 1
0
        protected static HttpResponseMessage SuccessMessageResponseWithBody <TContent>(TContent content)
        {
            var httpHesponseMessage = new HttpResponseMessage(HttpStatusCode.OK);

            httpHesponseMessage.Content = HttpContentConverter.ToJsonStringContent(content);

            return(httpHesponseMessage);
        }
        async Task <HttpResponseMessage> IHttpClientCallback.SendBodyAndCheckStatus <TRequest>(IHttpClientWrapper clientWrapper, HttpMethod action, TRequest request, string url)
        {
            using (var content = HttpContentConverter.ToJsonStringContent(request))
            {
                var requestMessage = CreateRequest(action, url, content);

                return(await SendRequestAndCheckStatus(clientWrapper, requestMessage));
            }
        }
Exemplo n.º 3
0
        protected static HttpResponseMessage SuccessMessageResponseWithHeadersAndBody <TContent>(IDictionary <string, string> headers, TContent content)
        {
            var httpHesponseMessage = new HttpResponseMessage(HttpStatusCode.OK);

            httpHesponseMessage.Content = HttpContentConverter.ToJsonStringContent(content);
            foreach (var header in headers)
            {
                httpHesponseMessage.Headers.Add(header.Key, header.Value);
            }

            return(httpHesponseMessage);
        }