Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use .header() and .post() at the same time in HttpSampler #120

Open
rachitm99 opened this issue Jan 5, 2024 · 1 comment
Open

Comments

@rachitm99
Copy link

i have been trying to send auth token and post data at the same time using this code

http_sampler = HttpSampler("sampler 1",url, timer,).header("Authorization", f"bearer {idToken}").post({"name":"abc"},ContentType.APPLICATION_JSON)

but it gives an error

AttributeError: 'us.abstracta.jmeter.javadsl.http.DslBaseHttpSample' object has no attribute 'post'

i tried to solve it myself and found that the value of self.java_wrapped_element when .header() is called is us.abstracta.jmeter.javadsl.http.DslHttpSampler but when .post() is called immediately after it, then the value changes to us.abstracta.jmeter.javadsl.http.DslBaseHttpSampler

but i am not good with classes so i couldn't find any solution for it

@cburkley
Copy link

This is occurring for me as well. Very glaring bug. Most if not all people will need to pass an auth token in a header with any post request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants