Skip to content
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

Allow bypassing content negotiation process #220

Merged
merged 1 commit into from
Oct 11, 2017
Merged

Allow bypassing content negotiation process #220

merged 1 commit into from
Oct 11, 2017

Conversation

petermorlion
Copy link
Contributor

This PR allows to set a MediaType property like this:

[CacheOutput(ClientTimeSpan = 50, ServerTimeSpan = 50, MediaType = "image/jpeg")]
public HttpResponseMessage Get(int id)
{
    var response = new HttpResponseMessage(HttpStatusCode.OK);
    response.Content = GetImage(id); // e.g. StreamContent, ByteArrayContent,...
    response.Content.Headers.ContentType = new MediaTypeHeaderValue("image/jpeg");
    return response;
}

This wil store the item as the given media type and always return it in this way.

@filipw
Copy link
Owner

filipw commented Oct 11, 2017

perfect - thanks!

@filipw filipw merged commit 50abde7 into filipw:dev Oct 11, 2017
@petermorlion petermorlion deleted the feature/mediatype branch October 11, 2017 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants