vasanth balu
vasanth balu

Reputation: 1

Programmatically Adding Headers Not Working

I'm trying to create a JMeter test plan programmatically using the JMeter API & Java platform. However, I'm encountering an issue where the headers I add via the HeaderManager are not included in the HTTP request.

I'm using maven dependency

<dependency>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>ApacheJMeter_core</artifactId>
    <version>5.6.2</version>
</dependency>`
HeaderManager headerManager = new HeaderManager();
headerManager.add(new Header("Content-Type", "application/json"));
headerManager.add(new Header("device-type", "x-vymo-device-type"));
HTTPSamplerProxy httpSampler = createHttpSampler();
httpSampler.setHeaderManager(headerManager);

These headers are not set properly.

Upvotes: 0

Views: 12

Answers (0)

Related Questions