Bug 15468 - Variable expansion in posted files in HTTPSampler
Summary: Variable expansion in posted files in HTTPSampler
Status: RESOLVED WONTFIX
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.5.1
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
: 36694 43850 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-12-18 01:11 UTC by Michal Kostrzewa
Modified: 2013-12-19 21:51 UTC (History)
4 users (show)



Attachments
Patch against 18/12/2002 cvs, made from src directory (9.11 KB, patch)
2002-12-18 01:22 UTC, Michal Kostrzewa
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Kostrzewa 2002-12-18 01:11:24 UTC
The content of posted files can depend on thread number, counters, parsed
content etc... in some application (real-life situation requested by Ananda)
Comment 1 Michal Kostrzewa 2002-12-18 01:22:53 UTC
Created attachment 4211 [details]
Patch against 18/12/2002 cvs, made from src directory
Comment 2 Michal Kostrzewa 2002-12-18 01:32:02 UTC
Attached patch adds new checkbox to HTTPSampler GUI: "Evaluate variables in
file". If it's unchecked, everything goes without changes: when sampling, the
uploaded file is opened and sent without thinking.
If it's checked, when populating TestElements the file is read and treated as
ordinary string property of TestElement. The advantage is that any variables
existing in the file are expanded. But there is drawback: content of the file is
written also in scenario file. The user should not bother, because the file is
read  when starting the test. When sampling evaluated content of the file is
sent rather than original file.
Comment 3 David Luu 2011-10-05 21:57:14 UTC
This would be nice patch to include in next release. This was an issue I just encountered as well. 

If one doesn't actually need to post a file, then workaround is to paste the content into the value field of name/value pair section for HTTP sampler, can leave name field blank (for cases like making REST API call rather than form submission). But the unfortunate part is the UI for the name/value pair section sucks for long input strings, as it isn't resizable to be multi-line, so usable but not readable. That's where this bug/issue fix comes in nicely as you can put the data in text file that's easier to read and POST than via the form fields. Alternative fix in my case is make the form fields resizable and multiline supported.
Comment 4 Philippe Mouawad 2011-10-23 20:26:54 UTC
*** Bug 36694 has been marked as a duplicate of this bug. ***
Comment 5 Philippe Mouawad 2012-01-24 18:12:19 UTC
*** Bug 43850 has been marked as a duplicate of this bug. ***
Comment 6 Ravi Challapalli 2012-01-25 14:45:00 UTC
Has this been incorporated or any plans to incorporate this (substitution of variables in POST data provided as file)?
Comment 7 Sebb 2012-01-25 15:12:27 UTC
The patch has not been incorporated, as it has some disadvantages.

Also, the HTTP Sampler GUI has been enhanced to include a raw post body (will be in 2.6, due very soon).
Comment 8 Ravi Challapalli 2012-01-26 12:29:32 UTC
Thanks a lot. Took the ApacheJMeter_http.jar from the last nightly build and used the raw POST with random variable - it worked great & solved my urgent purpose.
Comment 9 Philippe Mouawad 2013-08-25 21:05:22 UTC
Could also be closed as with RAW POST Body it is now much more user friendly.

Replacing within a file may also incur performance issues so not sure it is a good idea.
Comment 10 Philippe Mouawad 2013-12-19 21:51:00 UTC
Closing as with RAW  Body it is now much more user friendly.

Replacing within a file may also incur performance issues so not sure it is a good idea.
Comment 11 The ASF infrastructure team 2022-09-24 20:37:29 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/996