File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Simplify.Web.Json/ModelBinding/Binders Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -16,13 +16,13 @@ public class JsonModelBinder : IModelBinder
1616 /// <param name="args">The <see cref="ModelBinderEventArgs{T}"/> instance containing the event data.</param>
1717 public void Bind < T > ( ModelBinderEventArgs < T > args )
1818 {
19- if ( args . Context . Request . ContentType . Contains ( "application/json" ) )
20- {
21- if ( string . IsNullOrEmpty ( args . Context . RequestBody ) )
22- throw new ModelValidationException ( "JSON request body is null or empty" ) ;
19+ if ( ! args . Context . Request . ContentType . Contains ( "application/json" ) )
20+ return ;
2321
24- args . SetModel ( JsonConvert . DeserializeObject < T > ( args . Context . RequestBody ) ) ;
25- }
22+ if ( string . IsNullOrEmpty ( args . Context . RequestBody ) )
23+ throw new ModelValidationException ( "JSON request body is null or empty" ) ;
24+
25+ args . SetModel ( JsonConvert . DeserializeObject < T > ( args . Context . RequestBody ) ) ;
2626 }
2727 }
2828}
You can’t perform that action at this time.
0 commit comments