What happened?
Summary
createFetchWithAuth() currently builds server mode URLs by concatenating authHost and auth directly. If apiHost does not end with /, requests become invalid, e.g. https://api.example.comauth/... instead of https://api.example.com/auth/....
This conflicts with the documented contract and can break real consumers using mode="server".
Current behavior
In src/fetchWithAuth.ts, server mode uses:
authHost
auth
- request path
without normalizing slashes first.
Example broken case:
apiHost = "https://api.example.com"
- expected:
https://api.example.com/auth/users/me
- actual:
https://api.example.comauth/users/me
Related files
src/fetchWithAuth.ts
tests/fetchWithAuth.test.tsx
README.md
Steps to Reproduce
Create a new application and make the AUTH_SERVER value NOT have a / at the end.
Expected Behavior
Acceptance criteria
server mode correctly targets ${apiHost}/auth/...
- Works whether
apiHost is:
https://api.example.com
https://api.example.com/
- Existing tests are updated to reflect the intended contract
- Add test coverage for both normalized and non-normalized inputs
Environment
No response
Logs / stack traces
What happened?
Summary
createFetchWithAuth()currently buildsservermode URLs by concatenatingauthHostandauthdirectly. IfapiHostdoes not end with/, requests become invalid, e.g.https://api.example.comauth/...instead ofhttps://api.example.com/auth/....This conflicts with the documented contract and can break real consumers using
mode="server".Current behavior
In
src/fetchWithAuth.ts,servermode uses:authHostauthwithout normalizing slashes first.
Example broken case:
apiHost = "https://api.example.com"https://api.example.com/auth/users/mehttps://api.example.comauth/users/meRelated files
src/fetchWithAuth.tstests/fetchWithAuth.test.tsxREADME.mdSteps to Reproduce
Create a new application and make the AUTH_SERVER value NOT have a
/at the end.Expected Behavior
Acceptance criteria
servermode correctly targets${apiHost}/auth/...apiHostis:https://api.example.comhttps://api.example.com/Environment
No response
Logs / stack traces