Skip to content
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

[http] Use browser cookies #1167

Closed
skyf0l opened this issue Apr 9, 2024 · 2 comments · Fixed by #1192
Closed

[http] Use browser cookies #1167

skyf0l opened this issue Apr 9, 2024 · 2 comments · Fixed by #1192
Labels
enhancement New feature or request plugin: http

Comments

@skyf0l
Copy link

skyf0l commented Apr 9, 2024

I'd like reqwest on the rust side to be able to send a request to the server as the webview's browser: meaning automatically including the webview's cookies.

In addition, it would be interesting if, when a request is made to /something, the default domain was the one of the actual webpage (like the javascript fetch).

@amrbashir
Copy link
Member

amrbashir commented Apr 15, 2024

reqwest can have its own cookie store, you can enable its feature flag (I will open a PR to enable it by default)

tauri-plugin-http = { version = "2.0.0-beta", features = ["cookies"] } 

However we can't get the webview cookies and send them, so if you used the webview built-in fetch to set the cookie, you can't send it with the plugin fetch

In addition, it would be interesting if, when a request is made to /something, the default domain was the one of the actual webpage (like the javascript fetch).

I will open a PR for that

@lingoh
Copy link

lingoh commented May 13, 2024

tauri-plugin-http-2.0.0-beta.7/src/commands.rs
if matches!(
name,
// forbidden headers per fetch spec https://fetch.spec.whatwg.org/#terminology-headers
header::ACCEPT_CHARSET
| header::ACCEPT_ENCODING
| header::ACCESS_CONTROL_REQUEST_HEADERS
| header::ACCESS_CONTROL_REQUEST_METHOD
| header::CONNECTION
| header::CONTENT_LENGTH
| header::DATE
| header::DNT
| header::EXPECT
| header::HOST
| header::ORIGIN
| header::REFERER
| header::TE
| header::TRAILER
| header::TRANSFER_ENCODING
| header::UPGRADE
| header::VIA
) {
continue;
}
Why don't cookies allow customization?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin: http
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants