feat(core): add WindowBuilder::on_request, closes #3533#3618
feat(core): add WindowBuilder::on_request, closes #3533#3618lucasfernog merged 5 commits intodevfrom
WindowBuilder::on_request, closes #3533#3618Conversation
core/tauri/src/window.rs
Outdated
| /// Ok(()) | ||
| /// }); | ||
| /// ``` | ||
| pub fn on_request<F: Fn(&HttpRequest, &mut HttpResponse) + Send + Sync + 'static>( |
There was a problem hiding this comment.
Wdyt about renaming this method to something more specific? This might clash with IPC requests callbacks we implement in the future 🤔
Maybe on_http_request ?
There was a problem hiding this comment.
Yeah I thought about that too, though http might confuse users too..
There was a problem hiding this comment.
Yeah that's true, even though custom protocols are technically still http right?
Alternatively on_network_request?
There was a problem hiding this comment.
Yeah I think we'll have to go with http_request as it's more specific
There was a problem hiding this comment.
Another option that'd be more familiar to electron converts:
on_protocol_request?
There was a problem hiding this comment.
webview2 calls it WebResourceRequested, I like that one, so I changed to on_web_resource_request.
[skip ci] Co-authored-by: Jonas Kruckenberg <iterpre@protonmail.com>
core/tauri/src/manager.rs
Outdated
| if let Some(csp) = &asset.csp_header { | ||
| builder = builder.header("Content-Security-Policy", csp); | ||
| } | ||
| match builder.body(asset.bytes) { |
There was a problem hiding this comment.
I was going to do something with an error but it doesn't make sense, gonna revert
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Checklist
fix: remove a typo, closes #___, #___)Other information