Custom Content-Type header in Custom HTTP (TCP)

Igor Zafievsky 7 лет назад в Products / AV & Custom Systems обновлен Aleksandr Romanov (CTO) 7 лет назад 5

http://dev.iridiummobile.net/AV_%26_Custom_Systems doesn't specify, how to redefine a Content-Type http header. Is there a way to change it?

With a small trick

var dev=IR.GetDevice("AV & Custom Systems (HTTP)");
var headr="TestAgent" + String.fromCharCode(13) + String.fromCharCode(10) + "Content-Type: text/xml; charset=utf-8";
dev.SetParameters({UserAgent: headr});



Hm. Does it mean that AV & Custom HTTP driver doesn't send Content-Type header in POST request?

no, this trick only for GET

    GET / HTTP/1.1\r\n
    Connection: Keep-Alive\r\n
    User-Agent: TestAgent\r\n
    Content-Type: text/xml; charset=utf-8\r\n
    Accept: */*\r\n

    POST / HTTP/1.1\r\n
    Content-Length: 2\r\n
    Connection: Keep-Alive\r\n
    Keep-Alive: timeout=15, max=300\r\n
    User-Agent: TestAgent\r\n
    Content-Type: text/xml; charset=utf-8\r\n
    Accept: */*\r\n
    Content-Type: application/x-www-form-urlencoded\r\n


IR.GetDevice("AV & Custom Systems (HTTP)")..SendEx(
Type: "Type of forming a request", The following types are possible GET, POST, PUT.
Url: "Link to the object that is requested",
For POST and PUT requests Data field is also available.
Data: [""],
The next block is Header. it is what your client must send to the requested server.
Headers: {
"Content-Type": "application/json",
"Accept": "application/xml;",
"Accept-Language": "de,en-us;q=0.7,en;q=0.3",
"User-Agent" : "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"


Сервис поддержки клиентов работает на платформе UserEcho