-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
status: in progressImplementation is proceeding smoothlyImplementation is proceeding smoothlytype: bug
Description
Describe the bug
http.ClientOptions.maxRedirections provides undesired outcomes when trying to prevent redirects :
http.ClientOptions.maxRedirections |
Cargo.toml > tauri > features |
Outcome |
|---|---|---|
0 |
["api-all"] |
Redirected |
1 |
^ | Redirected |
0 |
["api-all", "reqwest-client"] |
Redirected |
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 specified Cargo.toml configuration and maxRedirections option value.
Expected behavior
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
}
}
}Platform and versions
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
Stack trace
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status: in progressImplementation is proceeding smoothlyImplementation is proceeding smoothlytype: bug