-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(core): add WindowBuilder::on_request
, closes #3533
#3618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I thought about that too, though http
might confuse users too..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's true, even though custom protocols are technically still http right?
Alternatively on_network_request
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think we'll have to go with http_request as it's more specific
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option that'd be more familiar to electron converts:
on_protocol_request
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why match here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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