MockMultipartHttpServletRequest pre-defines method "POST" and content type "multipart/form-data"

This commit is contained in:
Juergen Hoeller
2010-08-15 22:46:15 +00:00
parent 1841b14b21
commit 5b0448c609
3 changed files with 32 additions and 13 deletions

View File

@@ -47,6 +47,12 @@ public class MockMultipartHttpServletRequest extends MockHttpServletRequest impl
new LinkedMultiValueMap<String, MultipartFile>();
public MockMultipartHttpServletRequest() {
setMethod("POST");
setContentType("multipart/form-data");
}
/**
* Add a file to this request. The parameter name from the multipart
* form is taken from the {@link MultipartFile#getName()}.