daton_app/app/http/middleware/Test.middleware.ts

10 lines
319 B
TypeScript
Raw Normal View History

2020-10-05 16:44:05 +00:00
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.')
}
}
}