Skip to content

stiio/JsonMultipartFormDataSupport

 
 

Repository files navigation

https://www.nuget.org/packages/Stio.JsonMultipartFormDataSupport

JsonMultipartFormDataSupport

Morasiu's project is taken as a basis.
The main difference from the original source is reading the json body from Request.Form.Files.

Usage

  1. Simple add this to your ConfigureServices
services.AddJsonMultipartFormDataSupport(JsonSerializerChoice.SystemText);
  1. Create your wrapper
public class MyWrapper
{
    [Required]
    public IFormFile File { get; set; } = null!;

    [FromJson, Required]
    public MyJson Json { get; set; } = null!;
}

and then add to your controller

[HttpPost]
public IActionResult Post([FromForm] MyWrapper request)
{
    return this.Ok();
}

About

Adds support for json in multipart/form-data requests.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%