jeudi 28 février 2019

ASP.NET Core test method with DisableRequestSizeLimit

I have an ASP.NET Core project, with this method:

public async Task<ActionResult<ResultDto>> StartReadFiles(
    [ModelBinder(typeof(JsonModelBinder))] RequestDto request,
    IFormFile file1,
    IFormFile file2
)

After I pushed the method, the performance test failed because he sends very large files in the request.

So I added DisableRequestSizeLimit to the method:

[DisableRequestSizeLimit]
public async Task<ActionResult<ResultDto>> StartReadFiles(
    [ModelBinder(typeof(JsonModelBinder))] RequestDto request,
    IFormFile file1,
    IFormFile file2
)

And now, I want to write a test for this bug.

How can I fake the request with a very big body?

Aucun commentaire:

Enregistrer un commentaire