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

ParseError doesn't get logged as expected since [email protected] #25

Closed
bogeychan opened this issue Dec 24, 2024 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@bogeychan
Copy link
Owner

bogeychan commented Dec 24, 2024

This test fails with [email protected];

it("should log during ParseError", async () => {
const stream = new InMemoryDestination();
let isParseError = false;
const app = new Elysia()
.use(
logger({
stream,
autoLogging: true,
customProps(ctx) {
if (ctx.isError && ctx.code === "PARSE") {
isParseError = true;
}
return {};
},
})
)
.post("/", () => "", {
body: t.Object({
test: t.String(),
}),
});
const req = newReq({
method: "POST",
headers: { "Content-Type": "application/json" },
body: "",
});
await app.handle(req);
expect(isParseError).toBeTrue();
expect(stream.messages.length).toBe(2);
stream.expectToHaveContextProps(0, req);
const msg = stream.expectToHaveContextProps(1, req);
expect(msg).toHaveElysiaLoggerResponseProps();
});

blocked by: elysiajs/elysia#973

relates to: #16

@bogeychan bogeychan added the bug Something isn't working label Dec 24, 2024
@bogeychan bogeychan self-assigned this Dec 24, 2024
@bogeychan bogeychan changed the title ParseError doesn't get logged since [email protected] ParseError doesn't get logged as expected since [email protected] Dec 24, 2024
@bogeychan
Copy link
Owner Author

This has been fixed in the latest Elysia version; make sure to upgrade to at least 1.2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant