Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/eden/treaty/response.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}, {
Expand Down Expand Up @@ -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
}, {
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
})
})
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/better-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion docs/patterns/extends-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/patterns/extends-context/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ new Elysia()
)
})
.resolve(({ query: { age }, status }) => {
if(!age) return status(401)
if(!age) return status('Unauthorized')

return { age }
})
Expand Down