Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed invalid response model for HTTP 400 Bad Request responses on input parameter validation failure. #518

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Release Date: _unreleased_

- Fixed missing `RecordTopOfDbLedger` observer call in `LedgerTransactionsProcessor`.
- Fixed invalid response model for HTTP 400 Bad Request responses on input parameter validation failure.

## 1.0.0 - Babylon Launch
Release Date: 28.09.2023
Expand Down
12 changes: 9 additions & 3 deletions apps/GatewayApi/GatewayApiStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@

using GatewayApi.SlowRequestLogging;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Prometheus;
using RadixDlt.NetworkGateway.GatewayApi;
using RadixDlt.NetworkGateway.GatewayApi.Services;
using RadixDlt.NetworkGateway.PostgresIntegration;
using RadixDlt.NetworkGateway.PrometheusIntegration;
using System;
Expand Down Expand Up @@ -106,10 +108,14 @@ public void ConfigureServices(IServiceCollection services)
services
.AddControllers()
.AddControllersAsServices()
.AddNewtonsoftJson(o =>
.AddNewtonsoftJson(options =>
{
o.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
o.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc;
options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc;
})
.ConfigureApiBehaviorOptions(options =>
{
options.InvalidModelStateResponseFactory = ctx => ctx.HttpContext.RequestServices.GetRequiredService<IValidationErrorHandler>().GetClientError(ctx);
});

services
Expand Down