Skip to content
New issue

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

Cookies don't work when using an Elysia instance #126

Open
facundo-villa opened this issue Aug 30, 2024 · 1 comment
Open

Cookies don't work when using an Elysia instance #126

facundo-villa opened this issue Aug 30, 2024 · 1 comment

Comments

@facundo-villa
Copy link

Cookies don't get sent to subsequent requests when using Eden with an Elysia instance. Even when credentials: include is set.

I'm using Elysia version 1.1.9 and Eden 1.1.2

I expect set credential cookies to be sent to subsequent request, as to be able to correctly test endpoints that need authentication and/or tokens.

Cookies do work correctly when performing actual requests to the server from another HTTP client.

Sample code:

test("...", async () => {
	...

	const app = server(db); // Creates an Elysia instance
	const client = treaty(app, { fetch: { credentials: 'include' } });

       ...

	const response = await client.api.auth.token.post({ email: "..." });

	const users = await client.api.users.get(); // <-- This fails because cookies are not set

       ...
});
@facundo-villa
Copy link
Author

@SaltyAom Could you look at this? This is blocking a lot of my tests.

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

No branches or pull requests

1 participant