When submitting a form with a file upload control:
If the file upload parameter is not set to anything, HttpUnit does not even include a blank value for this parameter in the request header.
example header:
POST http://abstract.cs.washington.edu/~rogersb/httpunit-test/test.cgi HTTP/1.1 Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Accept-Encoding: gzip Host: abstract.cs.washington.edu Referer: http://abstract.cs.washington.edu/~rogersb/httpunit-test/test.html User-Agent: Java1.4.0 Content-Length: 298 Content-Type: multipart/form-data; boundary=--HttpUnit-part0-aSgQ2M Proxy-Connection: keep-alive
----HttpUnit-part0-aSgQ2M
Content-Disposition: form-data; name="SUBMIT"
Content-Type: text/plain; charset=iso-8859-1
Submit
Content-Disposition: form-data; name="text.field"
sample text
----HttpUnit-part0-aSgQ2M--
I should probably also mention that I used http://abstract.cs.washington.edu/~rogersb/httpunit-test/test.html for my test form.
What would you expect to see? According the the HTML specification, this is correct behavior. From the spec:
"If a control doesn't have a current value when the form is submitted, user agents are not required to treat it as a successful control."
If your application is depending on the parameter being transmitted with a blank value, it may not work with all browsers.
Thanks for the clarification.
Log in to post a comment.
When submitting a form with a file upload control:
If the file upload parameter is not set to anything, HttpUnit does not even include a blank value for this parameter in the request header.
example header:
POST http://abstract.cs.washington.edu/~rogersb/httpunit-test/test.cgi HTTP/1.1
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Accept-Encoding: gzip
Host: abstract.cs.washington.edu
Referer: http://abstract.cs.washington.edu/~rogersb/httpunit-test/test.html
User-Agent: Java1.4.0
Content-Length: 298
Content-Type: multipart/form-data; boundary=--HttpUnit-part0-aSgQ2M
Proxy-Connection: keep-alive
----HttpUnit-part0-aSgQ2M
Content-Disposition: form-data; name="SUBMIT"
Content-Type: text/plain; charset=iso-8859-1
Submit
----HttpUnit-part0-aSgQ2M
Content-Disposition: form-data; name="text.field"
Content-Type: text/plain; charset=iso-8859-1
sample text
----HttpUnit-part0-aSgQ2M--
I should probably also mention that I used
http://abstract.cs.washington.edu/~rogersb/httpunit-test/test.html
for my test form.
What would you expect to see? According the the HTML specification, this is correct behavior. From the spec:
"If a control doesn't have a current value when the form is submitted, user agents are not required to treat it as a successful control."
If your application is depending on the parameter being transmitted with a blank value, it may not work with all browsers.
Thanks for the clarification.