Forum Discussion

smcclay's avatar
smcclay
Occasional Contributor
13 years ago

HTTP Test Request - Attachment is sent twice

Hello,

I'm trying to POST a file to a URL using HTTP Test Request. I found the following instructions in the forum:

1) Create an HTTP Request Step
2) Set the method to POST
3) Set the "Media Type" of the content to multipart/form-data
4) Check the "Post QueryString" checkbox
5) Attach the file(s) you want to send in the Attachments tab at the bottom of the request window
6) Add the desired parameters and their values; those parameters that should contain the contents of an attachment ("fname" in your example) should have the value "file:<name of attachment>", for example "file:readme.txt" if you attached a file named readme.txt


My test step looks like this:


However, instead of the attachment being sent once with the requested parameters, it is sent twice:


------=_Part_2_171977183.1332778175776
Content-Type: text/xml
Content-Transfer-Encoding: binary
Content-Disposition: form-data; name="file"; filename="steve-batch.xml"

<?xml version="1.0" encoding="utf-8"?>
.....

------=_Part_2_171977183.1332778175776
Content-Type: application/xml; name=steve-batch.xml
Content-Transfer-Encoding: binary
Content-Disposition: form-data; name="steve-batch.xml"; filename="steve-batch.xml"

<?xml version="1.0" encoding="utf-8"?>
.....



This is what I get if I use curl:

curl --form file=@steve-batch.xml "http://10.191....../"

Content-Type: application/xml
Content-Disposition: form-data; name="file"; filename="steve-batch.xml"

...<?xml version="1.0" encoding="utf-8"?>
.....



curl works, and is what I'm looking for. What am I doing wrong with my test step?

Thanks,
--
Steve
No RepliesBe the first to reply