Add header
Adds a header to the request header set
- Parameters
- Advanced call ?
Function AddHeader(Val Name, Val Value, Val IgnoreEmpty = False) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Name | - | String | ✔ | Header key |
| Value | - | String | ✔ | Header value |
| IgnoreEmpty | - | Boolean | ✖ | Do not add header if empty value is passed |
Returns
DataProcessorObject.OPI_HTTPClient - This processor object
This method has no additional advanced call parameters.
Caution
NOCLI: this method is not available in CLI version
1C:Enterprise/OneScript code example
URL = "https://bin.openintegrations.dev";
URL = URL + "/get";
Result = OPI_HTTPRequests.NewRequest()
.Initialize()
.SetURL(URL)
.AddHeader("X-Header1", "Value1") // <---
.AddHeader("X-Header2", "Value2") // <---
.ProcessRequest("GET")
.ReturnResponseAsJSONObject();
Result
{
"args": {},
"headers": {
"Accept": "*/*",
"Accept-Charset": "utf-8",
"Accept-Encoding": "gzip",
"Connection": "Keep-Alive",
"Content-Length": "0",
"Host": "bin.openintegrations.dev",
"Max-Forwards": "10",
"User-Agent": "1Script v$2.0.1.0",
"X-Arr-Log-Id": "f8d81ac5-f382-4d53-8fc3-29fa57706c2f",
"X-Arr-Ssl": "2048|256|C=BE, O=GlobalSign nv-sa, CN=GlobalSign GCC R6 AlphaSSL CA 2025|CN=*.openintegrations.dev",
"X-Forwarded-Host": "bin.openintegrations.dev",
"X-Header1": "Value1",
"X-Header2": "Value2",
"X-Original-Url": "***"
},
"origin": "***",
"url": "https://bin.openintegrations.dev/get"
}