-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ContentType null #51
Comments
yes, the SO example doesn't set the content type header correctly. Set it On 15 December 2013 00:25, snblackout notifications@github.com wrote:
|
Thank you, I just decided to ditch the JsonContent from the SO article and just did: Return Request.CreateResponse(Of MyClass)(HttpStatusCode.OK, New MyClass()) That way your OutputCache is working fine and I can still return my own class structure back over the line. |
Using V2 line 153 of CacheOutputAttribute.cs:
_webApiCache.Add(cachekey + Constants.ContentTypeKey, actionExecutedContext.Response.Content.Headers.ContentType.MediaType, cacheTime.AbsoluteExpiration, baseKey);
Headers.ContentType = null.
I'm decorating my GET function like:
HttpGet
ActionName("GetThis")
CacheOutput(ServerTimeSpan:=5, ClientTimeSpan:=0)
Public Function DoGetThis(ByVal guid As String) As HttpResponseMessage
Returning:
New HttpResponseMessage() With {.Content = New JsonContent(New With {Key .Success = True, Key .Message = "Success", .NowPlaying = data})}
data is my own business logic class.
JsonContent is from http://stackoverflow.com/questions/14231877/how-to-return-json-object-on-web-api-controller
Am I doing something wrong?
The text was updated successfully, but these errors were encountered: