Return response as string
Returns the body of the response as a string
Function ReturnResponseAsString(Val Forced = False, Val ExceptionOnError = False) Export
Parameter | CLI option | Type | Required | Description |
---|---|---|---|---|
Forced | - | Boolean | ✖ | False > The processor object will be returned instead of the response if there were errors in it |
ExceptionOnError | - | Boolean | ✖ | Causes an exception with a log if there were errors during processing |
Returns: Arbitrary - The response or the same processing object
caution
NOCLI: this method is not available in CLI version
1C:Enterprise/OneScript code example
URL = "https://bin.openintegrations.dev";
URL = URL + "/post";
Image = "https://hut.openintegrations.dev/test_data/picture.jpg"; // URL, Path or Binary Data
Result = OPI_HTTPRequests.NewRequest()
.Initialize(URL)
.SetBinaryBody(Image)
.ProcessRequest("POST")
.ReturnResponseAsString(); // <---
Result
"{\r\n \"args\": {},\r\n \"data\": \"...\",\r\n \"files\": {},\r\n \"form\": {},\r\n \"headers\": {\r\n \"Accept\": \"*/*\",\r\n \"Accept-Charset\": \"utf-8\",\r\n \"Accept-Encoding\": \"gzip\",\r\n \"Connection\": \"Keep-Alive\",\r\n \"Content-Length\": \"2114023\",\r\n \"Content-Type\": \"application/octet-stream\",\r\n \"Host\": \"localhost:2424\",\r\n \"Max-Forwards\": \"10\",\r\n \"User-Agent\": \"1Script v$2.0.0.0\",\r\n \"X-Arr-Log-Id\": \"31fa3516-0edc-4764-8504-0ad624f55d69\",\r\n \"X-Arr-Ssl\": \"2048|256|C=BE, O=GlobalSign nv-sa, CN=GlobalSign GCC R6 AlphaSSL CA 2025|CN=*.openintegrations.dev\",\r\n \"X-Forwarded-Host\": \"bin.openintegrations.dev\",\r\n \"X-Original-Url\": \"/post\"\r\n },\r\n \"json\": null,\r\n \"origin\": \"***\",\r\n \"url\": \"https://bin.openintegrations.dev/post\"\r\n}"