ServiceStack PreRequestFilters vs RequestFilters

I look at AppHostBase.cs and it has the following:

 //.... public IContentTypeFilter ContentTypeFilters { get {return EndpointHost.ContentTypeFilter;} } public List<Action<IHttpRequest, IHttpResponse>> PreRequestFilters { get {return EndpointHost.RawRequestFilters;} } public List<Action<IHttpRequest, IHttpResponse, object>> RequestFilters { get {return EndpointHost.RequestFilters;} } public List<Action<IHttpRequest, IHttpResponse, object>> ResponseFilters { get {return EndpointHost.ResponseFilters;} } //.... 

I read from the SS site document and know that there are RequestFilters and ResponseFilters . But why is there a PreRequestFilter from RequestFilters ? What is this for?

I google'd and see a sample SignalR code written in PreRequestFilters , why not just write it in RequestFilters , what's the difference?

+4
source share
1 answer

According to the Procedure, pre-request filters are executed before DTO deserialization and after that regular RequestFilters are executed. Also note that query filters are executed in a specific order depending on whether they are implemented as attributes or registered through AppHost, and also based on the priority of the query filter attributes.

+5
source

Source: https://habr.com/ru/post/1501487/


All Articles