0
Under review

AV & Custom Systems (HTTP) filtering problem

Lewis 6 jaar geleden in Modules bijgewerkt door Vladimir Ovchinnikov (expert) 6 jaar geleden 5

Hello,


for using a REST API I need to make use of HTTP headers. Specifically Content-Length. I need to be able to send the header 'Content-Length: 0'. But it seems the DEVICE_CUSTOM_HTTP_TCP SendEx method filters any headers with the value of 0 or "0". Is there any workaround for this limitation?

Under review

Hello.

"Content-Length" is not set, it is calculated automatically on the basis of request contents.


Ok, then how to I make the request include 'Content-Length: 0'? Because right now it won't send the header at all if the content is empty.

IR.GetDevice("AV & Custom Systems (TCP)").Send(['Content-Length: 0']);

So, does this mean I have to use a TCP device instead of a HTTP_TCP device?


I already tried to implement my own HTTP packet using that method, but for some reason the EVENT_RECEIVE_TEXT listener doesn't fire when using DEVICE_CUSTOM_TCP.

The Send method allows you to send an arbitrary set of data to the equipment. You can send GET and POST to the TCP driver. If you know the exact data set, you can send it "as is" to the TCP driver. IR.EVENT_RECEIVE_TEXT is triggered when data is received and only in AV & Custom Systems.