diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-03-16 15:32:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 15:32:29 +0100 |
commit | 7d0b77440e635a666ed1c333df1217dd5fa043c1 (patch) | |
tree | 442d00a5bfa9cddeb5fbd6bbcb30cc4ec0bf1238 /cli/js/web/fetch.ts | |
parent | 49541a04d25ba7308759824213b6053a7b412e3e (diff) |
fix: fetch closes unused body (#4393)
This commit makes sure that "httpBody" resource is closed in case of redirections in fetch API.
Diffstat (limited to 'cli/js/web/fetch.ts')
-rw-r--r-- | cli/js/web/fetch.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/cli/js/web/fetch.ts b/cli/js/web/fetch.ts index c7209943f..acf0bad0f 100644 --- a/cli/js/web/fetch.ts +++ b/cli/js/web/fetch.ts @@ -531,6 +531,9 @@ export async function fetch( redirected ); if ([301, 302, 303, 307, 308].includes(response.status)) { + // We won't use body of received response, so close it now + // otherwise it will be kept in resource table. + close(fetchResponse.bodyRid); // We're in a redirect status switch ((init && init.redirect) || "follow") { case "error": |