Posts

Showing posts with the label delete header in jmeter

ADD EMPTY HEADER IN JMETER SAMPLE REQUEST

Image
ADD EMPTY HEADER IN J-METER SAMPLE REQUEST            In Jmeter Test Plan if you have multiple Request Sampler with globally defined HTTP Request Header and in one Request Tester does not want to use globally defined HTTP Request Header and want to edit/delete the Header with new header value.       Solution : - Add Bean Shell Preprocessor to that request and write the following code . import org.apache.jmeter.protocol.http.control.Header; sampler.getHeaderManager().remove(1); In Below Test Plan HTTP Request Header cointains 2 headers values -> Content-Type – Application/json Authorization – ${access_token} In Request OauthToken1,  I want to use header value as Content-type – text/xml and want to remove Authorization value . Add Bean shell preprocessor to OauthToken 1 . with above-defined code . Result :- In OauthToken1 Request , header values is passed as Content-type – text/xml with no...