Set HttpResponseMessage headers from within the Get method of my controller

370 Views Asked by At

I have a REST service using Web API 2.0 and MVC 5. My controller derives from EntitySetController. I have a Get method that returns the resource as an IQueryable. My question is how do I access the HttpResponseMessage object from within the Get function so that I can set some header values like the TransferEncodingChunked = true.

1

There are 1 best solutions below

1
On

You could try returning HttpResponseMessage instead and specify return code like that:

Request.CreateResponse(HttpStatusCode.OK, entitiesGoHere);