This commit is contained in:
2025-06-15 22:24:33 -04:00
parent f5de4c3a5b
commit 0e11c919b8

View File

@@ -43,8 +43,9 @@ local function playTTSFile(value)
local headers = {
["Content-Type"] = "application/x-www-form-urlencoded"
}
print("Sending HTTP POST request")
local response = http.request({
local response = http.post({
url = ttsRoute,
method = "POST",
body = body,
@@ -52,20 +53,10 @@ local function playTTSFile(value)
binary = false
})
-- Wait for the response
local event, resUrl, handle
repeat
event, resUrl, handle = os.pullEvent()
if event == "http_failure" and resUrl == url then
print("HTTP POST request failed for: " .. resUrl)
return
end
until event == "http_success" and resUrl == url
print("HTTP POST request successful" )
-- Read and parse response
local data = handle.readAll()
local data = response.readAll()
print(data)
handle.close()
response.close()
end
local function createSoundFile(fileName)