diff --git a/docs/eden/treaty/response.md b/docs/eden/treaty/response.md index 7aca25db..7eee3005 100644 --- a/docs/eden/treaty/response.md +++ b/docs/eden/treaty/response.md @@ -30,7 +30,7 @@ import { treaty } from '@elysiajs/eden' const app = new Elysia() .post('/user', ({ body: { name }, status }) => { - if(name === 'Otto') return status(400) + if(name === 'Otto') return status('Bad Request') return name }, { @@ -146,7 +146,7 @@ import { treaty, Treaty } from '@elysiajs/eden' const app = new Elysia() .post('/user', ({ body: { name }, status }) => { - if(name === 'Otto') return status(400) + if(name === 'Otto') return status('Bad Request') return name }, { diff --git a/docs/index.md b/docs/index.md index 2d526ac9..0ec75685 100644 --- a/docs/index.md +++ b/docs/index.md @@ -112,7 +112,7 @@ const role = new Elysia({ name: 'macro' }) role: (type: 'user' | 'staff' | 'admin') => ({ beforeHandle({ headers, status }) { if(headers.authorization !== type) - return status(401) + return status('Unauthorized') } }) }) @@ -159,7 +159,7 @@ export const auth = new Elysia() ssid: t.String() }), resolve({ cookie, status }) { - if(!cookie.ssid.value) return status(401) + if(!cookie.ssid.value) return status('Unauthorized') return { user: cookie.ssid.value @@ -189,7 +189,7 @@ export const auth = new Elysia() ssid: t.String() }), resolve({ cookie, status }) { - if(!cookie.ssid.value) return status(401) + if(!cookie.ssid.value) return status('Unauthorized') return { user: cookie.ssid.value diff --git a/docs/integrations/better-auth.md b/docs/integrations/better-auth.md index 516b3e32..7343b895 100644 --- a/docs/integrations/better-auth.md +++ b/docs/integrations/better-auth.md @@ -189,7 +189,7 @@ const betterAuth = new Elysia({ name: 'better-auth' }) headers }) - if (!session) return status(401) + if (!session) return status('Unauthorized') return { user: session.user, diff --git a/docs/patterns/extends-context.md b/docs/patterns/extends-context.md index 54be66a7..d360c52a 100644 --- a/docs/patterns/extends-context.md +++ b/docs/patterns/extends-context.md @@ -317,7 +317,7 @@ new Elysia() .derive(({ headers, status }) => { const auth = headers['authorization'] - if(!auth) return status(400) + if(!auth) return status('Unauthorized') return { bearer: auth?.startsWith('Bearer ') ? auth.slice(7) : null diff --git a/docs/tutorial/patterns/extends-context/index.md b/docs/tutorial/patterns/extends-context/index.md index 74f65d4b..dfd5a434 100644 --- a/docs/tutorial/patterns/extends-context/index.md +++ b/docs/tutorial/patterns/extends-context/index.md @@ -161,7 +161,7 @@ new Elysia() ) }) .resolve(({ query: { age }, status }) => { - if(!age) return status(401) + if(!age) return status('Unauthorized') return { age } })