Skip to content

fix(http): release resources for null-body responses - #3756

Open
Lorkydey wants to merge 1 commit into
tauri-apps:v2from
Lorkydey:fix/http-null-body-resource-cleanup
Open

Lorkydey wants to merge 1 commit into
tauri-apps:v2from
Lorkydey:fix/http-null-body-resource-cleanup

Conversation

@Lorkydey

Copy link
Copy Markdown

fetch_send puts each response in the webview's resource table until its body is read to EOF or cancelled. For null-body statuses, the JS wrapper creates Response(null) without a stream, so neither path runs. Even await response.arrayBuffer() only reads the empty JS body and leaves the Rust response in the table.

This awaits the existing dropBody() when no stream is created, releasing the native response before returning it to the caller. It addresses the null-body case in #3752, following @ocavue's report and analysis. Unread responses with non-empty bodies and the WebKit collection issue described there remain outside this change.

The regression tests cover 204, 205 and 304, both without reading and after arrayBuffer(). The example app exposes its webview's resource names so the tests can check the actual Rust table rather than just the JS response. Each of the six cases retained one response before the change; after it, all 16 HTTP e2e tests pass on Windows with WebView2 156.0.4314.50. Both runs used a different local fixture port because the default port was occupied; that override is not included in the PR.

cargo test -p tauri-plugin-http --lib --locked passes all 19 tests. Strict Clippy passes for the HTTP plugin and the example app with automation enabled. The workspace JS build, ESLint, TypeScript, Prettier, rustfmt and change-file checks pass. Other platforms have not been run locally.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Package Changes Through 170e2e8

There are 4 changes which include http with patch, http-js with patch, opener with patch, opener-js with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
api-example 2.0.57 2.0.58
api-example-js 2.0.53 2.0.54
opener 2.7.2 2.7.3
opener-js 2.7.2 2.7.3
http 2.8.3 2.8.4
http-js 2.8.3 2.8.4

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant