Get ActionDescriptor from WebApi MessageHandler

Viewed 127

how can i retrieve ActionDescriptor from a MessageHandler ?

I'm able to get the ContractDescriptor in the SendAsync method using this code:

var config = request.GetConfiguration();
_controllerSelector = config.Services.GetService(typeof(IHttpControllerSelector)) as IHttpControllerSelector;
HttpControllerDescriptor descriptor = _controllerSelector.SelectController(request);

But i don't know how to get the ActionDescriptor.

Thanks!!

1 Answers

You can use the extension from System.Net.Http.HttpRequestMessageExtensions:

//using System.Net.Http;

var actionDescriptor = request.GetActionDescriptor();
Related