Summary: | HTTP(S) Test Script Recorder: wrong postdata | ||
---|---|---|---|
Product: | JMeter - Now in Github | Reporter: | Biagio <bdn02> |
Component: | HTTP | Assignee: | JMeter issues mailing list <issues> |
Status: | NEW --- | ||
Severity: | normal | CC: | kungu, p.mouawad |
Priority: | P2 | Keywords: | PatchAvailable |
Version: | 3.1 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Attachments: | Try to guess if body data is of name=value form |
Description
Biagio
2017-01-26 14:10:18 UTC
Created attachment 34680 [details]
Try to guess if body data is of name=value form
If no content-type is given for a post body, or it is the default one, DefaultSamplerCreater will assume it is of the form name=value. This patch looks for an equals sign in the body and if it finds none, it will assume, that the body is not of the name=value form.
(In reply to Felix Schumacher from comment #1) > Created attachment 34680 [details] > Try to guess if body data is of name=value form > > If no content-type is given for a post body, or it is the default one, > DefaultSamplerCreater will assume it is of the form name=value. This patch > looks for an equals sign in the body and if it finds none, it will assume, > that the body is not of the name=value form. Hi Felix. What if content is json ? It will contain '=' , will it work ? AFAIK, recorder handles correctly json no ? @Biagio, could you provide the exact post body ? Thanks The patch will only work for the simplest case. It might even not work for base64 coded data. But the problem only arises, when no or the default content-type is used. My hope is, that clients sending JSON will use the correct content-type. Another possible solution would be to check whether the body data starts with a regex like "(?i)[a-z0-9_.-]{30}=.", assuming that keys are not too long and consists of only 'simple' characters. But that seems even less fool- or fail-proof. I am getting the same behavior on my tests because the content-type is not correctly set on the app i'm testing... What do you think if the behavior of DefaultSamplerCreater is changed like this: 1. Tries to parse data and splits name and value (I assume it's the current way of working) 2. If 'name' is not null AND 'value' is null, then consider that the format is just raw data, not name=value From a quick look, if it really was a name=value format but with an empty value, the data will still be sent to the server like received while recording, with no modifications, so it'll be fine. Let me know your thoughts! This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4248 |