API Endpoint is Invoked with `null` Argument
I am sending the following call
to the Following API endpoint
Yet
ad
is null
and this if
triggers.
First Question : why doesn't the Middleware already stop an Empty request ?
Second Question : I confirmed with the Browser DevTools that the request isn't actually empty, so where does my data go ?
DTO Class for reference
7 Replies
Try matching the casing
Either by adding
[JsonProperty]
attributes to your DTO properties with the camelCase
name
Or by sending data with PascalCase
property namesfyi, Access-Control-Allow-Origin is a response header and doesn't make sense to set on a request
I know, i hate cors i just threw everythin at it and haven cleaned properly, unrelated though
Not Successfull (and all other endpoints work case-insensitive)
The solution was types btw.
aren't dynamically typed languages great?
Very much so 😮💨 , altough i'm a little disapointed .NET doesn't parse the strings
Breaking change: ASP.NET Core apps allow deserializing quoted numbe...
Learn about the breaking change in .NET 5 where ASP.NET Core apps will successfully deserialize numbers that are represented as JSON strings instead of throwing an exception.
And I'm on .NET 8 so it most definitely should work, yet it doesn't 🤔
However I'm not to inclined to debug the middleware and possible configuration issues, as long as typed JSON just works