Code: Select all
Begin_Com Role(*EXTENDS #PRIM_SRVM)
Srvroutine Name(LINKS) Response(#RESPONSE)
* #RESPONSE.ContentType := "application/json"
#RESPONSE.AddHeader( "Access-Control-Allow-Origin" "http://x.x.x.x" )
#RESPONSE.ContentString := ...
Endroutine
End_ComThat works fine, and I get something like
Code: Select all
HTTP/1.1 200 OK
Connection: close
Date: Wed, 22 Mar 2017 11:35:37 GMT
Server: Apache
Content-Type: text/plain; charset=iso-8859-1
Access-Control-Allow-Origin: http://x.x.x.x
[{"icon-url": "/images/wamlinks/icons/alien.3.png","link-url": "https://google.com/","title": "Google"}]Code: Select all
* #RESPONSE.ContentType := "application/json"Code: Select all
HTTP/1.1 200 OK
Connection: close
Date: Wed, 22 Mar 2017 11:36:13 GMT
Server: Apache
Content-Type: application/json
Access-Control-Allow-Origin: http://x.x.x.x
žœ‰ƒ–•`¤™“z@a‰”‡…¢a¦”“‰•’¢a‰ƒ–•¢a“‰…•KóK—•‡k“‰•’`¤™“z@ˆ££—¢zaa‡––‡“…Kƒ–”ak£‰£“…z@Ç––‡“…GŸ