0
Answered
Custom Content-Type header in Custom HTTP (TCP)
Igor Zafievsky 8 years ago
in Products / AV & Custom Systems
•
updated by Aleksandr Romanov (CTO) 8 years ago •
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?
Customer support service by UserEcho
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});or
http://support.iridiummobile.net/topics/12528-anyone-here-with-a-ready-made-http-server-tcp_custom_server-script/
Hm. Does it mean that AV & Custom HTTP driver doesn't send Content-Type header in POST request?
no, this trick only for GET
POST / HTTP/1.1\r\n Host: 192.168.0.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 \r\nhttp://support.iridiummobile.net/topics/233-izmeneniya-v-drajvere-http-sendex/?lang=en
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)" }http://dev.iridiummobile.net/Drivers_API#.SendEx