From 4c8aaf82dc793bca8a7ab270fc1678cabffd6420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0nan=C3=A7=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 31 May 2024 19:04:59 +0300 Subject: [PATCH] Fix response.[frame|request] goja.Object usage Converting to a goja.Object here is unnecessary. --- browser/response_mapping.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/browser/response_mapping.go b/browser/response_mapping.go index af4b808b1..dc63a5ba9 100644 --- a/browser/response_mapping.go +++ b/browser/response_mapping.go @@ -12,7 +12,6 @@ func mapResponse(vu moduleVU, r *common.Response) mapping { //nolint:funlen if r == nil { return nil } - rt := vu.Runtime() maps := mapping{ "allHeaders": func() *goja.Promise { return k6ext.Promise(vu.Context(), func() (any, error) { @@ -29,9 +28,8 @@ func mapResponse(vu moduleVU, r *common.Response) mapping { //nolint:funlen return &buf, nil }) }, - "frame": func() *goja.Object { - mf := mapFrame(vu, r.Frame()) - return rt.ToValue(mf).ToObject(rt) + "frame": func() mapping { + return mapFrame(vu, r.Frame()) }, "headerValue": func(name string) *goja.Promise { return k6ext.Promise(vu.Context(), func() (any, error) { @@ -59,9 +57,8 @@ func mapResponse(vu moduleVU, r *common.Response) mapping { //nolint:funlen }) }, "ok": r.Ok, - "request": func() *goja.Object { - mr := mapRequest(vu, r.Request()) - return rt.ToValue(mr).ToObject(rt) + "request": func() mapping { + return mapRequest(vu, r.Request()) }, "securityDetails": func() *goja.Promise { return k6ext.Promise(vu.Context(), func() (any, error) {