aspnet / WebHooks

[Archived] Libraries to create and consume web hooks on ASP.NET Core. Project moved to https://github.com/aspnet/AspLabs
Apache License 2.0
627 stars 439 forks source link

Add `ModelStateInvalidFilter` to actions with an applied `WebHookAttribute` #240

Closed dougbu closed 6 years ago

dougbu commented 6 years ago

We should get rid of the if (!ModelState.IsValid)… boiler-plate in user code.

Should also throw an InvalidOperationException if [ApiController] is applied to a controller containing WebHook actions.

/cc @rynowak anything else we need to worry about now that WebHooks gets all the 2.1 goodness?

dougbu commented 6 years ago

More code we can clean up using 2.1 features: Don't need to special-case media type suffix matches and should instead use application/*+json or application/*+xml in WebHookVerifyBodyTypeFilter. The following hack can go away: https://github.com/aspnet/WebHooks/blob/ca7f0e7c9a11663be336d0d0412e0e26b4d9117a/src/Microsoft.AspNetCore.WebHooks.Receivers/Filters/WebHookVerifyBodyTypeFilter.cs#L167-L171

mkArtakMSFT commented 6 years ago

@danroth27, any objections about moving this out from preview2?

dougbu commented 6 years ago

ec834ebabb

dougbu commented 6 years ago

Merged to dev in 607d59b9e6