mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 04:53:11 +00:00
fix(workorders): align media multipart limit
This commit is contained in:
parent
a615be28e5
commit
06b88b6006
2 changed files with 11 additions and 0 deletions
|
|
@ -42,6 +42,16 @@ public class WorkOrderMediaControllerTests
|
|||
Assert.Equal(200_000_000L, bytes.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddMedia_HasTwoHundredMegabyteMultipartBodyLimit()
|
||||
{
|
||||
var method = typeof(WorkOrderMediaController).GetMethod(nameof(WorkOrderMediaController.AddMedia));
|
||||
var attribute = Assert.IsType<RequestFormLimitsAttribute>(Assert.Single(
|
||||
method!.GetCustomAttributes(typeof(RequestFormLimitsAttribute), inherit: true)));
|
||||
|
||||
Assert.Equal(200_000_000L, attribute.MultipartBodyLengthLimit);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AddMedia_FileOverLimit_ReturnsStableUnprocessableEntity()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ namespace Api.SeaHavenIndustries.Controllers
|
|||
|
||||
[HttpPost("{id:int}/media")]
|
||||
[RequestSizeLimit(MaxUploadBytes)]
|
||||
[RequestFormLimits(MultipartBodyLengthLimit = MaxUploadBytes)]
|
||||
public async Task<IActionResult> AddMedia(
|
||||
int id,
|
||||
[FromForm] WorkOrderMediaCategory? category,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue