Summary: | JMeter changes the HTTP header Content Type for POST request | ||
---|---|---|---|
Product: | JMeter - Now in Github | Reporter: | Houqiang Yan <yanhouqiang> |
Component: | HTTP | Assignee: | JMeter issues mailing list <issues> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | P2 | ||
Version: | Nightly (Please specify date) | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Attachments: |
Suggested patch
Updated suggested patch Updated suggested patch |
Description
Houqiang Yan
2007-02-01 11:37:40 UTC
Created attachment 19945 [details] Suggested patch This patch allows the user to specify what "content-type" header should be sent for a HTTP POST request, by adding a "HTTP Header Manager" config element as a child of the sampler, and then setting the content-type header and value there. If it is a multipart post request, then the code will set the content-type to the correct multipart / boundary value, no matter what the user has specified. If the user has not specified a content-type header via the "HTTP Header Manager", then the code will set content-type "application/x-www-form-urlencoded". If the user specifies no parameters for the POST request, but specifies a filename and mimetype, but no "file field name", then the file will be sent in the post body, with the value specified in "mimetype" as the value of the "content-type" header. If the user specifies one or more parameters, but none of the parameters have a name, then all the parameter values are concatenated, and sent as the sole post body. This patch also contains minor changes to the HTTP Proxy Server, to allow the proxy server to serve HTTP Post requests which has content-type different from "application/x-www-form-urlencoded", by just adding a parameter with value, but no name, to the http sampler. This, I think, should allow you to use the HTTP Proxy Server to record any HTTP post. So I think this patch also solves bug 39641. The HttpRequestHdr patch causes test failures - it changes the number of arguments that are parsed. Created attachment 19970 [details]
Updated suggested patch
I have fixed the problem exposed by the failing JUnit test, HTTP GET request
incorrectly got an extra parameter, due to the parsing of the "request body".
I have also added some new junit tests, and expanded the existing junit tests.
Created attachment 19971 [details]
Updated suggested patch
One change compared to the last suggested patch : now only add parameter for
the whole post body, if the length of postbody is greater than 0.
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1856 |