Class RequestMessageFilter
Filter responsible for adding important information to the request header.
Inheritance
System.Object
RequestMessageFilter
Namespace: StoneCo.Framework.Host.Api.Filters
Assembly: cs.temp.dll.dll
Syntax
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false)]
public class RequestMessageFilter : ActionFilterAttribute
Constructors
RequestMessageFilter()
Default constructor to configure base request message.
Declaration
public RequestMessageFilter()
Examples
In the host layer into configuration folder, create a new file that's name MvcOptionsConfigurations.
Create a new method as below.
public static MvcOptions ConfigureFilters(this MvcOptions options, IConfiguration configuration)
{
options.Filters.Add(new RequestMessageFilter());
return options;
}
RequestMessageFilter(IEnumerable<String>)
Default constructor to configure base request message with include new header keys.
Declaration
public RequestMessageFilter(IEnumerable<string> headerKeysToExtract)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<System.String> | headerKeysToExtract | New keys for header. |
Examples
In the host layer into configuration folder, create a new file that's name MvcOptionsConfigurations.
Create a new method as below.
public static MvcOptions ConfigureFilters(this MvcOptions options, IConfiguration configuration)
{
var headerKeysToExtract = new List<string>() { Headers.Brand };
options.Filters.Add(new RequestMessageFilter(headerKeysToExtract));
return options;
}
Methods
OnActionExecuting(ActionExecutingContext)
The call that happens before the method action is performed.
Declaration
public override void OnActionExecuting(ActionExecutingContext context)
Parameters
Type | Name | Description |
---|---|---|
ActionExecutingContext | context | Context to action. |