From 9bce77a08eb6c7d068814d1e066e546bbde91cd2 Mon Sep 17 00:00:00 2001 From: xRain Date: Sat, 29 May 2021 14:55:14 +0800 Subject: [PATCH] fix 301 302 --- Middlewares/SimApiExceptionMiddleware.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Middlewares/SimApiExceptionMiddleware.cs b/Middlewares/SimApiExceptionMiddleware.cs index adac20c..39d1d33 100644 --- a/Middlewares/SimApiExceptionMiddleware.cs +++ b/Middlewares/SimApiExceptionMiddleware.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using SimApi.Communications; @@ -34,7 +35,10 @@ namespace SimApi.Middlewares await Next(context); if (context.Response.StatusCode != 200) { - throw new SimApiException(context.Response.StatusCode); + if (!new[] {301, 302}.Contains(context.Response.StatusCode)) + { + throw new SimApiException(context.Response.StatusCode); + } } } catch (SimApiException ex)