How to upload MultipartFile in htmlunit?

139 Views Asked by At

I am using HtmlUnit to upload a file by making a request to the spring controller. The file is of type MultipartFile. Using the below code works only for File Type java.io.File. How do i make the call for MultipartFile?

WebRequest request = new WebRequest(new URL("/customer/uploadfile),POST);

request.setRequestParameters(toList(new KeyDataPair("newfile", file,"customerfile", "multipart/form-data", StandardCharsets.UTF_8)));

0

There are 0 best solutions below