Skip to content

MultipartFile[] required controller param, not throwing exception #25819

@funder7

Description

@funder7

Affects: 2.3.1.RELEASE


Hello,

I'm working with the following controller mapping:

@PostMapping("/upload-bag-picture")
public ResponseEntity<List<BagHistoryEventDTO>> uploadBagPicture (@RequestParam("bagPictures") MultipartFile[] bagPictures, @RequestParam Long bagId) { /* ... */ }

As you can see, it's supposed to receive an array of MultipartFiles.

I noticed that when sending the request from a Rest client, no exception is being thrown when the files parameter name is different from the one set into the controller:

This request will return 200 OK without any exception:
immagine

This instead is processed partially (one file has the right name):
immagine

I don't know if this is supposed to translate into an exception, but from what I saw until now, if a parameter is required, then even if only one is missing then the request should be intercepted before entering into the method body.

In case this is normal, I will close the issue. Thanks!

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions