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