public class HttpHeaders extends BaseConfigElement
This test element can be added at different levels (in the same way as HTTPHeaderManager) of a test plan affecting all samplers in the scope were is added. For example if httpHeaders is specified at test plan, then all headers will apply to http samplers; if it is specified on thread group, then only samplers on that thread group would be affected; if specified as a child of a sampler, only the particular sampler will include such headers. Also take into consideration that headers specified at lower scope will overwrite ones specified at higher scope (eg: sampler child headers will overwrite test plan headers).
| Modifier and Type | Class and Description |
|---|---|
static class |
HttpHeaders.CodeBuilder |
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,String> |
headers |
guiClass, name| Constructor and Description |
|---|
HttpHeaders() |
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.jmeter.testelement.TestElement |
buildTestElement() |
HttpHeaders |
contentType(org.apache.http.entity.ContentType contentType)
Allows to easily specify the Content-Type HTTP header.
|
HttpHeaders |
header(String name,
String value)
Allows to set an HTTP header to be used by HTTP samplers.
|
boolean |
isEmpty() |
buildConfiguredTestElement, buildTestElementGui, buildTreeUnder, configureTestElement, durationToSeconds, loadBeanProperties, showAndWaitFrameWith, showFrameWith, showInGui, showTestElementGuiclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuildTreeUnder, showInGuipublic HttpHeaders header(String name, String value)
To specify multiple headers just invoke this method several times with the different header names and values.
name - of the HTTP header.value - of the HTTP header.public HttpHeaders contentType(org.apache.http.entity.ContentType contentType)
contentType - value to use as Content-Type header.public boolean isEmpty()
protected org.apache.jmeter.testelement.TestElement buildTestElement()
buildTestElement in class BaseTestElementCopyright © 2023. All rights reserved.