Multipart/form-data request manually with JSF viewstate

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Multipart/form-data request manually with JSF viewstate

Beto C
Helo there,

I would appreciate any guidance with the following issue: I'm trying to
generate manually a multipart/form-data request to upload a file to an web
application (this file is a *.pdf). The particular challenge here is than
in one content-disposition field in body exists a JSF ViewState value and
when I try to copy the raw content from PDF file in the body of request
sampler of jmeter, the null characters were repl aced (I find out ,
something related to the fact that clipboard does not support null
characters) and the file pdf is damaged (corrupted). If there was no such
viewstate, I would have used the Parameters and File Upload section of the
HTTP Request Sampler. Thanks for any help or guidance that could be
provided.

-- Beto C.
Reply | Threaded
Open this post in threaded view
|

Re: Multipart/form-data request manually with JSF viewstate

glinius@live.com
Instead of copying and pasting the file contents into the .jmx script itself
you can use  __FileToString() function
<https://jmeter.apache.org/usermanual/functions.html#__FileToString>   which
reads the file from file system. This approach is way more robust and  VCS
<https://en.wikipedia.org/wiki/Version_control>  -friendly.

You can also check out  Testing REST API File Uploads in JMeter
<https://www.blazemeter.com/blog/testing-advanced-rest-api-file-uploads-jmeter>  
for an example of manually building a file upload request.





--
Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]