Код: Выделить всё
public class DemoModelBinder:IModelBinder {
public bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext)
{
Console.WriteLine(actionContext.Request.Headers.GetValues("Accept").FirstOrDefault());
//multipart/related; type=application/octet-stream
Console.WriteLine(actionContext.Request.Headers.Accept.Count);
//0
return false;
}
}
Код: Выделить всё
public ActionResult Index([ModelBinder(typeof(DemoModelBinder))]DemoRequest request )
{
return View();
}
Код: Выделить всё
curl http://127.0.0.1/ -H "Accept: multipart/related; type=application/octet-stream"
Подробнее здесь: https://stackoverflow.com/questions/785 ... st-headers