change middleware
parent
ca3959c60c
commit
f18c415979
|
@ -101,6 +101,10 @@ if (app.Environment.IsDevelopment())
|
|||
//app.UseSwagger();
|
||||
//app.UseSwaggerUI();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseHsts();
|
||||
}
|
||||
app.UseCors(x => x
|
||||
.SetIsOriginAllowed(origin => true)
|
||||
.AllowAnyMethod()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using NetinaShop.Repository.Migrations;
|
||||
using Refit;
|
||||
|
||||
|
@ -146,7 +147,7 @@ public class ExceptionHandlerMiddleware
|
|||
|
||||
context.Response.StatusCode = (int)httpStatusCode;
|
||||
context.Response.ContentType = "application/json";
|
||||
await context.Response.WriteAsync(json);
|
||||
await context.Response.WriteAsJsonAsync(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -172,7 +173,7 @@ public class ExceptionHandlerMiddleware
|
|||
|
||||
context.Response.StatusCode = (int)httpStatusCode;
|
||||
context.Response.ContentType = "application/json";
|
||||
await context.Response.WriteAsync(json);
|
||||
await context.Response.WriteAsJsonAsync(result);
|
||||
}
|
||||
|
||||
void SetUnAuthorizeResponse(Exception exception)
|
||||
|
|
Loading…
Reference in New Issue