Routing based on Media Type in ASP.Net MVC 5 / Web API 2 -


consider example of following actions in controller [routeprefix("api/some-entity")] attribute. request same except value of "content-type" header , of-course body content.

[httppost()] [requestheadermatchesmediatype("content-type", new[] { "application/vnd.company.sampledto.v1+json" })] [route("{id}")] public ihttpactionresult fork([fromuri]string id, [frombody]sampledto dto){    return ok(); }  [httppost()] [requestheadermatchesmediatype("content-type", new[] { "application/vnd.company.otherdto.v1+json" })] [route("{id}")] public ihttpactionresult fork([fromuri]string id, [frombody]otherdto dto){    return ok(); } 

i want route on bases of header values. should implementation of such attribute.


Comments

Popular posts from this blog

javascript - WinJS appendTextAsync producing scheduler errors -

minify - Minimizing css files -

Sockets with kotlin -