fix 301 302

This commit is contained in:
2021-05-29 14:55:14 +08:00
parent 8c7f4ac12f
commit 9bce77a08e
+4
View File
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using SimApi.Communications;
@@ -33,10 +34,13 @@ namespace SimApi.Middlewares
{
await Next(context);
if (context.Response.StatusCode != 200)
{
if (!new[] {301, 302}.Contains(context.Response.StatusCode))
{
throw new SimApiException(context.Response.StatusCode);
}
}
}
catch (SimApiException ex)
{
if (string.IsNullOrEmpty(ex.Message))