Skip to content

Commit 04fd3a7

Browse files
authored
fix(core): return empty body for HEAD requests to asset protocol, closes #11263 (#11264)
1 parent eda5713 commit 04fd3a7

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch:bug
3+
---
4+
5+
Respond with empty body for `HEAD` requests to `asset` protocol

crates/tauri/src/protocol/asset.rs

+4
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ fn get_response(
199199
})?;
200200
resp.body(buf.into())
201201
}
202+
} else if request.method() == http::Method::HEAD {
203+
// if the HEAD method is used, we should not return a body
204+
resp = resp.header(CONTENT_LENGTH, len);
205+
resp.body(Vec::new().into())
202206
} else {
203207
// avoid reading the file if we already read it
204208
// as part of mime type detection

0 commit comments

Comments
 (0)