22.01.2022, 15:52
Hi,
I am trying to convert a curl command to lua but cannot get it to work...
This is the curl command:
Result:
This is the lua code:
This results in:
Any hints?
TIA.
I am trying to convert a curl command to lua but cannot get it to work...
This is the curl command:
Code:
curl -X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0", "id":1", "method": "Input.Down"}' \
http://user:passwd@192.168.0.24:8080/jsonrpc
Code:
{"id":"1", "jsonrpc":"2.0", "result":"OK"}
This is the lua code:
Code:
socket = require('socket.http')
socket.TIMEOUT = 5
url = 'http://user:passwd@192.168.0.24:8080/jsonrpc'
body = '{"jsonrpc": "2.0", "id": 1, "method": "Input.Down"}'
res, code = socket.request({
url = url,
method = 'POST',
body = body,
headers = {'Content-Type: application/json'
}
})
log(res)
log(code)
Code:
testing 22.01.2022 16:14:46
* number: 200
testing 22.01.2022 16:14:46
* number: 1
Any hints?
TIA.