@@ -40,6 +40,34 @@ func mapBrowserToGoja(vu k6modules.VU) *goja.Object {
40
40
return obj
41
41
}
42
42
43
+ // mapResponse to the JS module.
44
+ func mapResponse (rt * goja.Runtime , r api.Response ) mapping {
45
+ maps := mapping {
46
+ "allHeaders" : r .AllHeaders ,
47
+ "body" : r .Body ,
48
+ "finished" : r .Finished ,
49
+ "frame" : func () * goja.Object {
50
+ mf := mapFrame (rt , r .Frame ())
51
+ return rt .ToValue (mf ).ToObject (rt )
52
+ },
53
+ "headerValue" : r .HeaderValue ,
54
+ "headerValues" : r .HeaderValues ,
55
+ "headers" : r .Headers ,
56
+ "headersArray" : r .HeadersArray ,
57
+ "jSON" : r .JSON ,
58
+ "ok" : r .Ok ,
59
+ "request" : r .Request ,
60
+ "securityDetails" : r .SecurityDetails ,
61
+ "serverAddr" : r .ServerAddr ,
62
+ "size" : r .Size ,
63
+ "status" : r .Status ,
64
+ "statusText" : r .StatusText ,
65
+ "url" : r .URL ,
66
+ }
67
+
68
+ return maps
69
+ }
70
+
43
71
// mapElementHandle to the JS module.
44
72
func mapElementHandle (rt * goja.Runtime , eh api.ElementHandle ) mapping {
45
73
maps := mapping {
@@ -238,11 +266,14 @@ func mapPage(rt *goja.Runtime, p api.Page) mapping {
238
266
mf := mapFrame (rt , p .MainFrame ())
239
267
return rt .ToValue (mf ).ToObject (rt )
240
268
},
241
- "opener" : p .Opener ,
242
- "pause" : p .Pause ,
243
- "pdf" : p .Pdf ,
244
- "press" : p .Press ,
245
- "reload" : p .Reload ,
269
+ "opener" : p .Opener ,
270
+ "pause" : p .Pause ,
271
+ "pdf" : p .Pdf ,
272
+ "press" : p .Press ,
273
+ "reload" : func (opts goja.Value ) * goja.Object {
274
+ r := mapResponse (rt , p .Reload (opts ))
275
+ return rt .ToValue (r ).ToObject (rt )
276
+ },
246
277
"route" : p .Route ,
247
278
"screenshot" : p .Screenshot ,
248
279
"selectOption" : p .SelectOption ,
0 commit comments