File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ public static EndpointFilterDelegate Create(EndpointFilterFactoryContext context
2929 return next ;
3030 }
3131
32+ var jsonOptions = context . ApplicationServices . GetService < IOptions < JsonOptions > > ( ) ;
33+ var serializerOptions = jsonOptions ? . Value ? . SerializerOptions ;
34+ options . SerializerOptions = serializerOptions ;
35+
3236 var serviceProviderIsService = context . ApplicationServices . GetService < IServiceProviderIsService > ( ) ;
3337
3438 // Use a list to only store validatable parameters instead of arrays for all parameters
@@ -61,10 +65,6 @@ public static EndpointFilterDelegate Create(EndpointFilterFactoryContext context
6165 {
6266 ValidateContext ? validateContext = null ;
6367
64- // Get JsonOptions from DI
65- var jsonOptions = context . HttpContext . RequestServices . GetService < IOptions < JsonOptions > > ( ) ;
66- var serializerOptions = jsonOptions ? . Value ? . SerializerOptions ;
67-
6868 foreach ( var entry in validatableParameters )
6969 {
7070 if ( entry . Index >= context . Arguments . Count )
@@ -82,7 +82,6 @@ public static EndpointFilterDelegate Create(EndpointFilterFactoryContext context
8282
8383 if ( validateContext == null )
8484 {
85- options . SerializerOptions = serializerOptions ;
8685 validateContext = new ValidateContext
8786 {
8887 ValidationOptions = options ,
You can’t perform that action at this time.
0 commit comments