简体   繁体   中英

Which formatter is used when I send a multipart request to a Web API Controller in ASP.NET CORE?

Checking the ASP.NET Core built-in formatters there seems to be no multipart formatter. Yet a multipart request is model bound, so there needs to be some kind of input formatter, that creates the key-value pairs, which are then model bound. Which formatter is that?

Model is bound during model binding . Model binder in its turn uses IValueProvider to get values from request. There is FormValueProvider for multipart content, which in its turn gets values from FormValueProviderFactory provided by request.ReadFormAsync() call. Default implementation of HttpRequest redirects the call to FormFeature 's ReadFormAsync . So you can find all the logic for reading multipart content values there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM