Problem testing a multipart/form-data servlet, error request rejected no multipart boundry was found
"Nicole Lacoste" <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi All,
I have a servlet whose doPost method expects a form that contains both
text inputs and a file input. I am testing this servlet using
HttpUnit and have been running into the problem that when ever I
submitt my form I get the error "request rejected no multipart boundry
was found". In the form I am setting the
enctype="multipart/form-data" and a assert that tests if the WebForm
is submittedAsMime returns true. Here is my test code...
------------
ServletRunner sr = new ServletRunner(myWebXmlFile);
ServletUnitClient client = sr.newClient();
WebResponse response = client.getResponse("http://test/my-servlet-url-pattern");
WebForm form = response.getFormWithID("my-form-id");
form.setParameter("param1", "value1");
form.setParameter("param2", "value2");
form.setParameter("document", new File("my/file/example.txt"));
SubmitButton mySB= form.getSubmitButton("my-submit-button-name");
form.submit(mySB);
--------------
The last line form.submit(mySB) throws an HttpException with the
message "request rejected no multipart boundry was found".
I have searched the mailing list database and have read that it is
possible to test multipart forms with HttpUnit, but can't find any
details on how to do this. Can anyone help me?
Thanks,
Nicole
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/