Skip to content

Commit 07ea9c7

Browse files
att
1 parent 3b8bca7 commit 07ea9c7

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

src/session/constructor.lua

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ Session.newSession = function (private_server_props,props)
1111
selfobject.public_method_extends(PublicSession)
1212

1313

14-
15-
16-
17-
local requisition = props.requisition
18-
if not requisition then
14+
local body = props.body
15+
if not body then
1916

2017
local args = props.args
2118
if not args then
@@ -33,10 +30,7 @@ Session.newSession = function (private_server_props,props)
3330
end
3431

3532
local use_automation_extension = props.use_automation_extension or false
36-
requisition = {
37-
method = "POST",
38-
http_version = "1.1",
39-
body = {
33+
body = {
4034
capabilities = {
4135
alwaysMatch = {
4236
browserName = "chrome",
@@ -51,21 +45,25 @@ Session.newSession = function (private_server_props,props)
5145
}
5246
}
5347
}
54-
}
5548
}
49+
5650
end
57-
requisition.url =selfobject.private.url.."/session"
58-
59-
6051

52+
local requisition = {
53+
url =selfobject.private.url.."/session",
54+
method = "POST",
55+
http_version = "1.1",
56+
body=body
57+
}
58+
6159
local result = selfobject.private.fetch(requisition)
6260

6361

64-
local body = result.read_body_json()
65-
selfobject.private.session_id = body.value.sessionId
62+
local response_body = result.read_body_json()
63+
selfobject.private.session_id = response_body.value.sessionId
6664

6765
if not selfobject.private.session_id then
68-
error(json.dumps_to_string(body))
66+
error(json.dumps_to_string(response_body))
6967
end
7068

7169
return selfobject.public

0 commit comments

Comments
 (0)