Closed dougbu closed 8 years ago
What's the actual problem here? What observed behavior is odd, unusual, or difficult to work with?
The first bullet point is handled by the associated bug.
The second bullet point doesn't seem concerning.
The third bullet point already has the right behavior: if no file is provided, there's no data. That seems to provide the best developer experience.
object
s are created for unbound POCO parameters only when usingComplexTypeModelBinder
. This leads to the following inconsistent behaviours:[FromBody]
parameters are leftnull
when the incoming request has an empty body. See #4750 for example.string
converter (i.e.SimpleTypeModelBinder
handles them) are leftnull
when the form contains no corresponding data.IFormFile
parameters are leftnull
when no matching files are submitted.Empty collections are created in most unbound and
IsTopLevelObject
cases due to activation code inCollectionModelBinder
,HeaderModelBinder
et cetera. Butbyte[]
arrays are often leftnull
e.g. when the corresponding<input/>
was left blank.The question is whether we should address these inconsistencies in 1.1.0. Should certainly check how earlier Web API and MVC releases handle the above cases. But might decide these inconsistencies are warts regardless. Or could split the scearios into "API" and "view" groups, then make separate decisions for each.