Alternative for HttpActionContext.RequestContentKeyValueModel on ASP.NET Web API
asp.net, asp.net-web-api, c#
Solution
You can use `HttpContext.Current.Request.Form`.
EDIT
You can always hide it behind interface:
public interface IKeyValueProvider
{
string GetValue(string key);
}
class RequestFormKeyValueProvider : IKeyValueProvider
{
public string GetValue(string key)
{
return HttpContext.Current.Request.Form[key];
}
}
Inject `IKeyValueProvider` in your controllers and mock in your tests.
Problem
Since from version beta of ASP.NET Web API, I have used `HttpActionContext.RequestContentKeyValueModel` to get input parameters from body of POST request: ``` public override void OnActionExecuting(HttpActionContext actionContext) { var requestContentKeyValueModel = actionContext.RequestContentKeyValueModel; //Do something in here base.OnActionExecuting(actionContext); } ``` but in the new release version RC, this property disappeared, is there any alternative for this?