Thanks! The following appears to work for me.
public class NoContent : ActionFilterAttribute
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
ObjectContent content = actionExecutedContext.Response.Content as ObjectContent;
if (content != null && content.Value == null)
HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.NoContent);
actionExecutedContext.Response = response;
So in general, is it OK to substitute a response message in an action filter with a different generic type? I mean are there any other dependencies on the original type that was intendant to be retuned?
BTW, throwing new HttpResponseException(HttpStatusCode.NoContent); results with HTTP/1.1 500 which I didn’t expect… but I’m probably missing something here.