Skip to content

Commit

Permalink
Fix response.[frame|request] goja.Object usage
Browse files Browse the repository at this point in the history
Converting to a goja.Object here is unnecessary.
  • Loading branch information
inancgumus committed Jun 4, 2024
1 parent 5d44fa4 commit 1982d55
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions browser/response_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 1982d55

Please sign in to comment.