Initial commit
This commit is contained in:
9
app/http/middleware/Test.middleware.ts
Normal file
9
app/http/middleware/Test.middleware.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Middleware, Request, http, HTTPStatus } from '../../../bundle/daton.ts'
|
||||
|
||||
export default class TestMiddleware extends Middleware {
|
||||
public async handleRequest(request: Request) {
|
||||
if ( Math.random() >= 0.5 ) {
|
||||
return http(HTTPStatus.FORBIDDEN, 'Well, you were unlucky.')
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user