diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-21 09:27:09 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-21 09:27:09 +0800 |
| commit | a5ac465ab59197a55a222d30ebd2cf26ffe80f86 (patch) | |
| tree | 8ea3696897f99878545f3e7c7aa1e7249b95b81b /tests/FundLab.Api.Tests/PersistenceTests.fs | |
| parent | 0aad89fc76aa77524625964ebad896a6bc0d3660 (diff) | |
| download | fund-lab-a5ac465ab59197a55a222d30ebd2cf26ffe80f86.tar.gz | |
Fix F# option JSON serialization in confirmation/positions API responses
Giraffe 6's default Newtonsoft serializer wrapped F# Some values as
Value/IsSome/IsNone objects, breaking the confirmation and positions
response contract (amounts must be exact decimal strings, absent
fields null, quote object-or-null). Add OptionJsonConverter plus a
shared serializer registration applied to both the Kestrel host and
the in-process test fixture, and cover confirmation/positions over
real HTTP including pending, conflict, cross-fund and Kestrel
restart-replay regressions.
Diffstat (limited to 'tests/FundLab.Api.Tests/PersistenceTests.fs')
| -rw-r--r-- | tests/FundLab.Api.Tests/PersistenceTests.fs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/FundLab.Api.Tests/PersistenceTests.fs b/tests/FundLab.Api.Tests/PersistenceTests.fs index 64e857c..5a049af 100644 --- a/tests/FundLab.Api.Tests/PersistenceTests.fs +++ b/tests/FundLab.Api.Tests/PersistenceTests.fs @@ -200,7 +200,10 @@ type ApiProcess(connectionString: string) = module PersistenceTestHelpers = let invoke (handler: HttpHandler) (method: string) (path: string) (headers: (string * string) list) (body: string) = let context = DefaultHttpContext() - use services = ServiceCollection().AddGiraffe().BuildServiceProvider() + use services = + (ServiceCollection() |> App.addOptionFriendlyJson) + .AddGiraffe() + .BuildServiceProvider() context.RequestServices <- services context.Request.Method <- method |
