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 May 31, 2024
1 parent a95f88a commit 07e6608
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": r.AllHeaders,
"body": func() *goja.Promise {
Expand All @@ -25,9 +24,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 07e6608

Please sign in to comment.