﻿using System.Net.Http;
using MyCouch.Extensions;

namespace MyCouch.Responses.Materializers
{
    public class BasicResponseMaterializer
    {
        public virtual void Materialize(Response response, HttpResponseMessage httpResponse)
        {
            response.RequestUri = httpResponse.RequestMessage.RequestUri;
            response.StatusCode = httpResponse.StatusCode;
            response.RequestMethod = httpResponse.RequestMessage.Method;
            response.ContentLength = httpResponse.Content.Headers.ContentLength;
            response.ContentType = httpResponse.Content.Headers.ContentType.ToString();
            response.ETag = httpResponse.Headers.GetETag();
        }
    }
}
﻿using System.Net.Http;
using MyCouch.Extensions;

namespace MyCouch.Responses.Materializers
{
    public class BasicResponseMaterializer
    {
        public virtual void Materialize(Response response, HttpResponseMessage httpResponse)
        {
            response.RequestUri = httpResponse.RequestMessage.RequestUri;
            response.StatusCode = httpResponse.StatusCode;
            response.RequestMethod = httpResponse.RequestMessage.Method;
            response.ContentLength = httpResponse.Content.Headers.ContentLength;
            response.ContentType = httpResponse.Content.Headers.ContentType != null ? httpResponse.Content.Headers.ContentType.ToString() : null;
            response.ETag = httpResponse.Headers.GetETag();
        }
    }
}
Fix for content type NULL in rare cercumstances
Fix for content type NULL in rare cercumstances
