Clean up middleware; solidify support for route handler classes
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
import Middleware from '../../../lib/src/http/Middleware.ts'
|
||||
import {Request} from '../../../lib/src/http/Request.ts'
|
||||
import {http} from '../../../lib/src/http/response/helpers.ts'
|
||||
import {HTTPStatus} from '../../../lib/src/const/http.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