Skip to content

Conversation

@Bijit-Mondal
Copy link
Contributor

@Bijit-Mondal Bijit-Mondal commented Jul 22, 2025

The previous convertToRequest implementation was fragile and failed to correctly forward all necessary request data (cookies), leading to session management issues (refresh-tokens).

This commit refactors the function to be more robust and reliable by:

  • Using standard h3 helpers (getRequestURL, readRawBody, parseCookies) for idiomatic conversion.
  • Ensuring the full URL, including query parameters, is preserved.
  • Explicitly parsing and reconstructing the Cookie header to guarantee session data is passed correctly.
  • Using readRawBody and Blob to forward the request body without mutation.
  • Replacing the non-standard duplex property with credentials: 'include'.

Checklist for important updates

  • Changelog has been updated
  • Changes to the version if needed
    • In package.json
    • In package-lock.json
    • In lib/ts/version.ts
  • Had run npm run build-pretty
  • Had installed and ran the pre-commit hook
  • If added a new recipe, I also modified types to include the new recipe in Recipe and allRecipes
  • If added a new frontend, I also modified types to include the new frontend in SupportedFrontends and allFrontends if required
  • If added a new backend, I also modified types to include the new backend in SupportedBackends and allBackends if required

Remaining TODOs for this PR

  • Item1
  • Item2

The previous `convertToRequest` implementation was fragile and failed to correctly forward all necessary request data (cookies), leading to session management issues (refresh-tokens).

This commit refactors the function to be more robust and reliable by:
- Using standard `h3` helpers (`getRequestURL`, `readRawBody`, `parseCookies`) for idiomatic conversion.
- Ensuring the full URL, including query parameters, is preserved.
- Explicitly parsing and reconstructing the `Cookie` header to guarantee session data is passed correctly.
- Using `readRawBody` and `Blob` to forward the request body without mutation.
- Replacing the non-standard `duplex` property with `credentials: 'include'`.
@Bijit-Mondal
Copy link
Contributor Author

@porcellus @DBozhinovski please review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant