Skip to content

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

Merged
merged 5 commits into from
Mar 6, 2022

Conversation

lucasfernog
Copy link
Member

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • I have added a convincing reason for adding this feature, if necessary

Other information

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature. The key has expired.
lucasfernog Lucas Fernandes Nogueira
@lucasfernog lucasfernog requested a review from a team March 5, 2022 20:11
@lucasfernog lucasfernog requested a review from a team as a code owner March 5, 2022 20:11
/// Ok(())
/// });
/// ```
pub fn on_request<F: Fn(&HttpRequest, &mut HttpResponse) + Send + Sync + 'static>(
Copy link
Member

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 ?

Copy link
Member Author

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..

Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

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.

lucasfernog and others added 3 commits March 5, 2022 17:50

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
[skip ci]

Co-authored-by: Jonas Kruckenberg <iterpre@protonmail.com>

Verified

This commit was signed with the committer’s verified signature. The key has expired.
lucasfernog Lucas Fernandes Nogueira

Verified

This commit was signed with the committer’s verified signature. The key has expired.
lucasfernog Lucas Fernandes Nogueira
…change-response
if let Some(csp) = &asset.csp_header {
builder = builder.header("Content-Security-Policy", csp);
}
match builder.body(asset.bytes) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why match here?

Copy link
Member Author

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

Verified

This commit was signed with the committer’s verified signature. The key has expired.
lucasfernog Lucas Fernandes Nogueira
@lucasfernog lucasfernog merged commit 3b13fda into dev Mar 6, 2022
@lucasfernog lucasfernog deleted the feat/change-response branch March 6, 2022 13:15
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.

None yet

2 participants