Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 06f3f08

Browse files
committed
Fix oak middleware (#284)
1 parent f6c6055 commit 06f3f08

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

server/oak.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Context } from 'https://deno.land/x/[email protected]/context.ts'
22
import type { Middleware } from 'https://deno.land/x/[email protected]/middleware.ts'
3+
import { NativeRequest } from 'https://deno.land/x/[email protected]/http_server_native.ts'
34
import { Application } from './app.ts'
45
import { Server } from './server.ts'
56

@@ -8,7 +9,12 @@ export function alephOak(app: Application): Middleware {
89
const server = new Server(app)
910

1011
return (ctx: Context) => {
11-
server.handle(ctx.request.originalRequest)
12-
ctx.respond = false
12+
const { originalRequest } = ctx.request
13+
if (originalRequest instanceof NativeRequest) {
14+
ctx.throw(500, 'Aleph.js doesn\'t support NativeRequest yet')
15+
} else {
16+
server.handle(originalRequest)
17+
ctx.respond = false
18+
}
1319
}
1420
}

0 commit comments

Comments
 (0)