Rust SDK does not set ACCEPT header
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 178
- Forks
- 96
- Avg merge
- 6d 23h
- Merged PRs (30d)
- 3
Description
Preflight checklist
- I could not find a solution in the existing issues, docs, nor discussions.
- I agree to follow this project's Code of Conduct.
- I have read and am following this repository's Contribution Guidelines.
- I have joined the Ory Community Slack.
- I am signed up to the Ory Security Patch Newsletter.
Ory Network Project
No response
Describe the bug
When using kratos-client-rust in WASM, the ACCEPT header is set to */* for all requests, resulting in 303 redirect requests on browser flow endpoints.
It is unclear if this is as a result of a lack of functionality in openapi-generator or if the custom Ory templates do not include the necessary lines as the header is set in other SDKs.
This could also be by design, however there is no way to set the ACCEPT header meaning the browsers tested will automatically follow the 303 response in the AJAX request, and other SDKs such as Go do explicitly set this to application/json.
Reproducing the bug
- Setup self hosted kratos
- call
ory_kratos_client::apis::frontend_api::create_browser_login_flowfrom a rust project, specifically WASM - Observe a XHR request with
Accept: */* - Receive a 303 response redirecting to the login UI as if directly accessed from the browser instead of the expected 200 with JSON response.
Relevant log output
No response
Relevant configuration
No response
Version
1.0.0
On which operating system are you observing this issue?
Other
In which environment are you deploying?
Other
Additional Context
Running in a Yew v0.21.0 Rust WASM app bundled with Trunk v0.17.5.
Tested against Kratos 1.0.0 in Chrome 118.0.5993.117 and Safari 17.0 on macOS, however the line parameters are missing from the generated rust sources meaning it could be undefined behavior.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated Rust source for ory_kratos_client::apis::frontend_api::create_browser_login_flow and compare its request headers with the Go SDK, checking whether the openapi-generator or custom templates are responsible. Done means WASM requests send Accept: application/json and browser login flow calls receive the expected JSON response rather than a 303 redirect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100