forked from ddrilling/AsbCloudServer
hotfix Configure System.Text.Json.JsonSerializer to handle inf, -inf, NaN
This commit is contained in:
parent
278445cdbd
commit
cb1ab8c842
@ -10,6 +10,11 @@ namespace AsbCloudWebApi
|
|||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
|
private static readonly System.Text.Json.JsonSerializerOptions jsonSerializerOptions = new System.Text.Json.JsonSerializerOptions
|
||||||
|
{
|
||||||
|
NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowNamedFloatingPointLiterals,
|
||||||
|
};
|
||||||
|
|
||||||
public Startup(IConfiguration configuration)
|
public Startup(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
Configuration = configuration;
|
Configuration = configuration;
|
||||||
@ -19,7 +24,12 @@ namespace AsbCloudWebApi
|
|||||||
|
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddControllers();
|
services.AddControllers()
|
||||||
|
.AddJsonOptions(new System.Action<Microsoft.AspNetCore.Mvc.JsonOptions>(opts =>
|
||||||
|
{
|
||||||
|
opts.JsonSerializerOptions.NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowNamedFloatingPointLiterals;
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
services.AddSwagger();
|
services.AddSwagger();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user