13.06.2024, 10:14
This didn't work either. Nevertheless I found a solution for setting the limit without using the json lib.
Code:
ltn12 = require('ltn12')
http = require('socket.http')
body = 'data={"serial":"000000000000", "limit_type":"1", "limit_value":"'..limit..'"} '
res, code, headers, status = http.request({
url = 'http://192.168.1.000/api/limit/config',
method = 'POST',
headers = {
['Authorization'] = 'Basic '..(mime.b64('admin:password')),
['Content-Type'] = 'application/x-www-form-urlencoded',
['Content-Length'] = #body,
},
source = ltn12.source.string(body),
})
log(res, code, headers, status)