Skip to content
This repository was archived by the owner on Sep 2, 2024. It is now read-only.

Commit 7713da1

Browse files
committed
added a Body.Close() to prevent memory leak
1 parent 34e6120 commit 7713da1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

function/runtime.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ func (env *ExecutionEnvironment) addHelpers(vm *goja.Runtime) {
181181
if err != nil {
182182
return vm.ToValue(Result{OK: false, Content: fmt.Sprintf("error calling fetch(): %s", err.Error())})
183183
}
184+
response.Body.Close()
185+
184186
return vm.ToValue(Result{OK: true, Content: HTTPResponse{Status: response.StatusCode, Body: string(bodyBytes)}})
185187
}
186188
return goja.Undefined()

0 commit comments

Comments
 (0)