I implemented compression per the solution here:
However, my Delete Web API is throwing an exception:
public HttpResponseMessage Delete(int id)
{
if (_repo == null)
{
_uow = DependencyResolver.Current.GetService<TPS.Data.Can.IUnitOfWork>();
_repo = _uow.TradeSpendRepository;
}
if (!_repo.Delete(id))
{
return Request.CreateResponse(HttpStatusCode.NotFound);
}
_uow.Save();
return Request.CreateResponse(HttpStatusCode.OK);
}
The exception is thrown in the CompressedContent's constructor because content is null:
if (content == null)
{
throw new ArgumentNullException("content");
}
I guess returning a status code isn't enough! What's the best approach to prevent this exception?