I've been trying to use params and specify multipart/form-data, but it
always gets output as application/x-www-form-urlencoded. I saw a reference
to this problem(?) from Ilya in the archive:
http://sourceforge.net/mailarchive/message.php?msg_id=8191433
Has this been confirmed as a bug? Is there a work-around? Is it possible
to force the Content Type, regardless of whether a file upload is involved?
Here's the relevant snip from my test:
$webtest->run_tests(
[
{
.
},
{
test_name =>
'translate text document from local file',
terse =>
$terse,
url =>
$base_url,
method =>
'post',
params =>
['form', 'do_add_doc',
'go', '',
'lang_pair', $lang_pair_string_short,
'encoding', 'utf8',
'quality', '7',
'priority', '1',
'translit', 'on',
'type', 'local_file',
'file', ['C:\WebTestFiles\inputara.txt', 'C:\WebTestFiles\inputara.txt'],
'mime_type', 'text/plain'],
text_require =>
['C:\WebTestFiles\inputara.txt' ]
}
]
);
I can see the file data and the parameters in the request, but the Content
Type is always wrong and the response is not correct. This is true, even
when I explicitly state the Content Type in the list for 'file'.
I use syntax similar to the snip above for other forms that do not upload a
file. These test work, even though the Content Type is output incorrectly.
Any help is appreciated.
v/r
- David
|