-
Notifications
You must be signed in to change notification settings - Fork 416
Open
Description
What is the type of issue?
Something else
What is the issue?
When working on the first assignment of the Macro page, the "Enforce Body Schema" task was marked as success even though I haven't actually done what was required:

Here's the full contents of the editor in case it's useful:
import { Elysia, t } from 'elysia'
function isPerfectSquare(x: number) {
const s = Math.floor(Math.sqrt(x))
return s * s === x
}
function isFibonacci(n: number) {
if (n < 0) return false
return isPerfectSquare(5 * n * n + 4) || isPerfectSquare(5 * n * n - 4)
}
new Elysia()
.macro('auth', {
cookie: t.Object({
session: t.String()
}),
beforeHandle({cookie: {session}, status}) {
if (!session.value) return status(401)
}
})
.macro('isBodyNumber', {
beforeHandle({body}) {
if (!Number.isInteger(body)) return
}
})
.post('/', ({ body }) => body, {auth: true})
.listen(3000)
Where did you find it?
Metadata
Metadata
Assignees
Labels
No labels