-
-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Elysia is running?
elysia@1.4.19
What platform is your computer?
Linux 6.8.0-87-generic x86_64
What steps can reproduce the bug?
Reproduction:
// --------- Server (Elysia) ----------
import { Elysia, t } from 'elysia';
const a = new Elysia()
.get(
'/profile',
({ headers }) => ({ user: 'hello', token: headers.authorization }),
{
// <- enforce that Authorization must be present
headers: t.Object({
authorization: t.String(),
}),
}
)
.listen(3000);
// --------- Client (Eden treaty) ----------
import { treaty } from '@elysiajs/eden';
type Api = typeof a;
const api = treaty<Api>('http://localhost:3000', {
// default header for every request
headers: { authorization: 'Bearer Aponia' },
});
await api.profile.get(); // sends Authorization: Bearer Aponia but errors in typescript.What is the expected behavior?
The default header passed to the eden api instance does make the header option on the request obsolete.
What do you see instead?
Typescript error on the api.profile.get() call.
Expected 1 arguments, but got 0.ts(2554)
treaty2.d.mts(39, 849): An argument for 'options' was not provided.
Additional information
No response
Have you try removing the node_modules and bun.lockb and try again yet?
used fresh setup in reproduction with latest versions
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working