Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MockMvc and Multiple Files #26275

Closed
asa-git opened this issue Dec 15, 2020 · 3 comments
Closed

MockMvc and Multiple Files #26275

asa-git opened this issue Dec 15, 2020 · 3 comments
Assignees
Labels
in: test Issues in the test module status: duplicate A duplicate of another issue

Comments

@asa-git
Copy link

asa-git commented Dec 15, 2020

Hiya,

I'm not sure if it is a regression from the correction of #26166 but in version 5.3.2 using the method file of MockMultipartHttpServletRequestBuilder to attach multiple MockMultipartFile seems to generate a request with only the last file.

This ends up generating a MissingServletRequestParameterException in a web controller configured with multiple @RequestParam for each MultipartFile in its method signature.

Note:
My dependency to this framework is from Spring boot version 2.4.1
Switching back to Spring boot 2.3.7.RELEASE which relies on Spring Framework 5.2.12.RELEASE solve the issue.

Best regards

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Dec 15, 2020
@rstoyanchev
Copy link
Contributor

Is it possible that this is a duplicate of #26261, in other words that files are missing depending on whether they are created with an originalFilename?

@rstoyanchev rstoyanchev added the status: waiting-for-feedback We need additional information before we can continue label Dec 15, 2020
@asa-git
Copy link
Author

asa-git commented Dec 15, 2020

I have just updated my test to force a filename to one the MockMultipartFile which was set to null ( a JSON content generated dynamically) and indeed it did resolve the issue.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Dec 15, 2020
@rstoyanchev
Copy link
Contributor

Okay I'll mark this as a duplicate then. There is a fix in the latest 5.3.3 snapshot if you want to give it a try to see if everything works for you.

@rstoyanchev rstoyanchev added status: duplicate A duplicate of another issue in: test Issues in the test module and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged or decided on labels Dec 15, 2020
@rstoyanchev rstoyanchev self-assigned this Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants