-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
refactor(core): return 200 on any IPC call, closes #10286 #10585
Conversation
By default the webview prints a `Failed to load resource: the server responded with a status of 400 (Bad Request) ipc://localhost` error message when a command returns an error, which is confusing to users. This changes the IPC to return status 200 on any call, with a header to indicate whether the result was ok or not. This removes the console error, which would only log the actual error result if it isn't caught by the user.
Package Changes Through de7ce6aThere are 6 changes which include tauri-build with prepatch, tauri-codegen with prerelease, tauri-utils with prerelease, tauri-cli with prerelease, @tauri-apps/cli with prerelease, tauri with prerelease Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
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.
shouldn't we add a change file?
core/tauri/scripts/ipc-protocol.js
Outdated
@@ -42,7 +42,8 @@ | |||
} | |||
}) | |||
.then((response) => { | |||
const cb = response.ok ? callback : error | |||
const cb = | |||
response.headers.get('tauri-response') === 'ok' ? callback : error |
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.
should we use Tauri-Response
to match the header on Rust side (just for consistency, it doesn't matter logically)
Never mind, devtools is powerful enough to display a response header in the network panel |
what i should update and to which version to receive a fix of 400 ? |
should wait until rc-3 publish? |
yes |
By default the webview prints a
Failed to load resource: the server responded with a status of 400 (Bad Request) ipc://localhost
error message when a command returns an error, which is confusing to users.This changes the IPC to return status 200 on any call, with a header to indicate whether the result was ok or not. This removes the console error, which would only log the actual error result if it isn't caught by the user.