@@ -40,6 +40,44 @@ func mapBrowserToGoja(vu k6modules.VU) *goja.Object {
40
40
return obj
41
41
}
42
42
43
+ // mapRequest to the JS module.
44
+ func mapRequest (rt * goja.Runtime , r api.Request ) mapping {
45
+ maps := mapping {
46
+ "allHeaders" : r .AllHeaders ,
47
+ "failure" : r .Failure ,
48
+ "frame" : func () * goja.Object {
49
+ mf := mapFrame (rt , r .Frame ())
50
+ return rt .ToValue (mf ).ToObject (rt )
51
+ },
52
+ "headerValue" : r .HeaderValue ,
53
+ "headers" : r .Headers ,
54
+ "headersArray" : r .HeadersArray ,
55
+ "isNavigationRequest" : r .IsNavigationRequest ,
56
+ "method" : r .Method ,
57
+ "postData" : r .PostData ,
58
+ "postDataBuffer" : r .PostDataBuffer ,
59
+ "postDataJSON" : r .PostDataJSON ,
60
+ "redirectedFrom" : func () * goja.Object {
61
+ mr := mapRequest (rt , r .RedirectedFrom ())
62
+ return rt .ToValue (mr ).ToObject (rt )
63
+ },
64
+ "redirectedTo" : func () * goja.Object {
65
+ mr := mapRequest (rt , r .RedirectedTo ())
66
+ return rt .ToValue (mr ).ToObject (rt )
67
+ },
68
+ "resourceType" : r .ResourceType ,
69
+ "response" : func () * goja.Object {
70
+ mr := mapResponse (rt , r .Response ())
71
+ return rt .ToValue (mr ).ToObject (rt )
72
+ },
73
+ "size" : r .Size ,
74
+ "timing" : r .Timing ,
75
+ "url" : r .URL ,
76
+ }
77
+
78
+ return maps
79
+ }
80
+
43
81
// mapResponse to the JS module.
44
82
func mapResponse (rt * goja.Runtime , r api.Response ) mapping {
45
83
maps := mapping {
@@ -50,13 +88,16 @@ func mapResponse(rt *goja.Runtime, r api.Response) mapping {
50
88
mf := mapFrame (rt , r .Frame ())
51
89
return rt .ToValue (mf ).ToObject (rt )
52
90
},
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 ,
91
+ "headerValue" : r .HeaderValue ,
92
+ "headerValues" : r .HeaderValues ,
93
+ "headers" : r .Headers ,
94
+ "headersArray" : r .HeadersArray ,
95
+ "jSON" : r .JSON ,
96
+ "ok" : r .Ok ,
97
+ "request" : func () * goja.Object {
98
+ mr := mapRequest (rt , r .Request ())
99
+ return rt .ToValue (mr ).ToObject (rt )
100
+ },
60
101
"securityDetails" : r .SecurityDetails ,
61
102
"serverAddr" : r .ServerAddr ,
62
103
"size" : r .Size ,
0 commit comments