Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9bce77a08e |
@@ -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))
|
||||||
|
|||||||
Reference in New Issue
Block a user