Compare commits

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