From 8e1409bd173e449980bd17419e16bae6b1fb8493 Mon Sep 17 00:00:00 2001 From: spiral Date: Thu, 14 Oct 2021 10:24:44 -0400 Subject: [PATCH] fix(apiv2): get rid of large asp.net bad request errors should also fix it for v1 :) --- PluralKit.API/Startup.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PluralKit.API/Startup.cs b/PluralKit.API/Startup.cs index df292497..1a01356c 100644 --- a/PluralKit.API/Startup.cs +++ b/PluralKit.API/Startup.cs @@ -62,7 +62,11 @@ namespace PluralKit.API { // ... though by default it messes up timestamps in JSON opts.SerializerSettings.DateParseHandling = DateParseHandling.None; - }); + }) + .ConfigureApiBehaviorOptions(options => + options.InvalidModelStateResponseFactory = (context) => + throw Errors.GenericBadRequest + ); services.AddApiVersioning();