We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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.ClientOptions.maxRedirections provides undesired outcomes when trying to prevent redirects :
http.ClientOptions.maxRedirections
Cargo.toml
tauri
features
0
["api-all"]
1
["api-all", "reqwest-client"]
Network Error: error following redirect for url (https://d.cv.vg/8Qa): too many redirects
This most likely occurs when trying to limit redirects to a specific amount as well.
Call http.getClient with the specified Cargo.toml configuration and maxRedirections option value.
http.getClient
maxRedirections
The request is not redirected and succeeds, like the following Node equivalent :
import axios from 'axios'; (async () => { const { status, headers: { location }, data } = await axios( 'https://d.cv.vg/8Qa', { maxRedirects: 0, validateStatus: status => status === 302 } ); console.log(JSON.stringify( { status, location, data }, null, 4 )); })().catch(console.error);
Which outputs :
{ "status": 302, "location": "https://source.unsplash.com/1080x2248/?technology", "data": { "url": "https://source.unsplash.com/1080x2248/?technology", "randomConfigIndex": 4, "creationTimestamp": 1645028091549, "config": { "configs": [ { "url": "https://source.unsplash.com/1080x2248/?nature" }, { "url": "https://source.unsplash.com/1080x2248/?space" }, { "url": "https://source.unsplash.com/1080x2248/?food" }, { "url": "https://source.unsplash.com/1080x2248/?animals" }, { "url": "https://source.unsplash.com/1080x2248/?technology" } ], "isRandom": true } } }
Environment › OS: Ubuntu 21.10 X64 › Node.js: 16.16.0 › npm: 8.11.0 › pnpm: Not installed! › yarn: 1.22.19 › rustup: 1.24.3 › rustc: 1.61.0 › cargo: 1.61.0 › Rust toolchain: stable-x86_64-unknown-linux-gnu Packages › @tauri-apps/cli [NPM]: 1.0.2 › @tauri-apps/api [NPM]: 1.0.1 › tauri [RUST]: 1.0.2, › tauri-build [RUST]: 1.0.2, › tao [RUST]: 0.12.1, › wry [RUST]: 0.19.0, App › build-type: bundle › CSP: default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self' › distDir: ../dist › devPath: http://localhost:1234/ App directory structure ├─ src ├─ .git ├─ .parcel-cache ├─ src-tauri ├─ .idea ├─ dist └─ node_modules
No response
The text was updated successfully, but these errors were encountered:
feat(core): implement max_redirections for attohttpc, ref #4795
41d6235
Thanks for catching this, fix will be available in the next release.
Sorry, something went wrong.
feat(core): implement max_redirections for attohttpc, ref #4795 (#4811)
ba5560b
feat(core): do not follow redirects if max_redirects is 0 closes #4795
max_redirects
44cdfb8
d576e8a
No branches or pull requests
Describe the bug
http.ClientOptions.maxRedirections
provides undesired outcomes when trying to prevent redirects :http.ClientOptions.maxRedirections
Cargo.toml
>tauri
>features
0
["api-all"]
1
0
["api-all", "reqwest-client"]
1
Network Error: error following redirect for url (https://d.cv.vg/8Qa): too many redirects
This most likely occurs when trying to limit redirects to a specific amount as well.
Reproduction
Call
http.getClient
with the specifiedCargo.toml
configuration andmaxRedirections
option value.Expected behavior
The request is not redirected and succeeds, like the following Node equivalent :
Which outputs :
Platform and versions
Stack trace
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: