Skip to content

Commit 433e49d

Browse files
refat on allert
1 parent 9b1613d commit 433e49d

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

src/session/alerts.lua

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
-- Aceita o alerta (clica em "OK")
2-
PublicSession.accept_alert = function(public, private)
1+
PublicSession.accept_alert = function(_, private)
32
local result = private.fetch({
43
url = private.url .. "/session/" .. private.session_id .. "/alert/accept",
54
method = "POST",
6-
http_version = "1.1"
5+
http_version = "1.1",
6+
headers = {
7+
["Content-Type"] = "application/json"
8+
},
9+
body = {}
710
})
11+
812
if result.status_code ~= 200 then
913
error("Failed to accept alert: " .. result.read_body())
1014
end
@@ -15,7 +19,11 @@ PublicSession.dismiss_alert = function(public, private)
1519
local result = private.fetch({
1620
url = private.url .. "/session/" .. private.session_id .. "/alert/dismiss",
1721
method = "POST",
18-
http_version = "1.1"
22+
http_version = "1.1",
23+
headers = {
24+
["Content-Type"] = "application/json"
25+
},
26+
body = {}
1927
})
2028
if result.status_code ~= 200 then
2129
error("Failed to dismiss alert: " .. result.read_body())
@@ -27,7 +35,11 @@ PublicSession.get_alert_text = function(public, private)
2735
local result = private.fetch({
2836
url = private.url .. "/session/" .. private.session_id .. "/alert/text",
2937
method = "GET",
30-
http_version = "1.1"
38+
http_version = "1.1",
39+
headers = {
40+
["Content-Type"] = "application/json"
41+
},
42+
body = {}
3143
})
3244
if result.status_code ~= 200 then
3345
error("Failed to get alert text: " .. result.read_body())

src/session/extra.lua

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,3 @@ PublicSession.get_session_id = function(public, private)
22
return private.session_id
33
end
44

5-
PublicSession.accept_alert = function(_, private)
6-
local result = private.fetch({
7-
url = private.url .. "/session/" .. private.session_id .. "/alert/accept",
8-
method = "POST",
9-
http_version = "1.1",
10-
headers = {
11-
["Content-Type"] = "application/json"
12-
},
13-
body = {}
14-
})
15-
16-
if result.status_code ~= 200 then
17-
error("Failed to accept alert: " .. result.read_body())
18-
end
19-
end

0 commit comments

Comments
 (0)