Http Raw Request & PUT is not including the file attachment?

1,427 views
Skip to first unread message

rjh...@gmail.com

unread,
Aug 8, 2014, 12:17:13 PM8/8/14
to jmeter-...@googlegroups.com
I'm trying to construct a PUT request with form data as well as an attachment.  I captured a successful request via Postman, but when I use it in JMeter, I get a 200 response from my server and the file size is zero.  It does not seem the file (an image or video) is being included in the request.  What am I doing incorrect?  It is also taking a very long time to complete - about 60sec, while the Postman returns almost immediately.  Is this something else I'm doing wrong?


Data File Path: <set to the file to be attached, same name as in the Request Data>

Request Data:
PUT {myurl} HTTP/1.1
Host: {my host}
Connection: keep-alive
Content-Length: 23482
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryCHXrBBNBo5ZJScNq
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8

------WebKitFormBoundaryCHXrBBNBo5ZJScNq
Content-Disposition: form-data; name="name"

album
------WebKitFormBoundaryCHXrBBNBo5ZJScNq
Content-Disposition: form-data; name="thumbnail"; filename="grumpy-thumb.jpg"
Content-Type: image/jpeg


------WebKitFormBoundaryCHXrBBNBo5ZJScNq--

Andrey Pohilko

unread,
Aug 9, 2014, 5:35:16 AM8/9/14
to jmeter-...@googlegroups.com
Hi,

Can you post a screenshot of your sampler?

--
Andrey

пятница, 8 августа 2014 г., 20:17:13 UTC+4 пользователь rjh.sgc написал:

Roger Hwang

unread,
Aug 11, 2014, 9:22:53 AM8/11/14
to jmeter-...@googlegroups.com
the line below is cut off in the screenshot


------WebKitFormBoundaryCHXrBBNBo5ZJScNq--


--
You received this message because you are subscribed to a topic in the Google Groups "jmeter-plugins" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jmeter-plugins/c6m5D0FXi0E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jmeter-plugin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Screen Shot 2014-08-11 at 9.18.47 AM.png

Roger Hwang

unread,
Aug 11, 2014, 9:24:33 AM8/11/14
to jmeter-...@googlegroups.com
files are not big... yet. currently about 50kb max.  I'd like to eventually upload much larger files, around 50mb-100mb

Andrey Pohilko

unread,
Aug 11, 2014, 11:26:16 AM8/11/14
to jmeter-...@googlegroups.com
The screenshot looks well.

Please check jmeter.log file, is it contains any errors related to HTTP Raw Sampler? 

If not then I suggest you using network sniffer like Wireshark to verify that request contains file data. If it does, then you have some mistakes in your request. Wireshark is really helpful in such investigations.

--
Andrey

понедельник, 11 августа 2014 г., 17:24:33 UTC+4 пользователь rjh.sgc написал:
To unsubscribe from this group and all its topics, send an email to jmeter-plugins+unsubscribe@googlegroups.com.

rhwa...@gmail.com

unread,
Aug 11, 2014, 3:11:28 PM8/11/14
to jmeter-...@googlegroups.com
thanks very much for your help

It looks like the end boundary is not being sent for the multipart/form-data in jmeter.  This may explain why the request takes very long to process -- the server is waiting and then dumping the contents on timeout?  Could the content-length header be incorrect?  I copied everything from postman, including newlines, but maybe there's an incorrect/extra spacing somewhere?

To unsubscribe from this group and all its topics, send an email to jmeter-plugin...@googlegroups.com.
jmeter-wireshark.png
postman-wireshark.png

Andrey Pohilko

unread,
Aug 11, 2014, 3:51:31 PM8/11/14
to jmeter-...@googlegroups.com
Yes, the wrong Content-Length header might lead to such problems. Its value must be exact length of the request body. Of course for body length both part in GUI field and in file counts. Don't forget that HTTP Raw Request uses \r\n as line endings in request data field.

--
Andrey

понедельник, 11 августа 2014 г., 23:11:28 UTC+4 пользователь rjh.sgc написал:

rahul22...@gmail.com

unread,
Sep 4, 2017, 1:15:23 PM9/4/17
to jmeter-plugins, rjh...@gmail.com
Please go through the following link in case you are getting any issues of File upload with PUT request.

Reply all
Reply to author
Forward
0 new messages