You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
477 B
13 lines
477 B
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.')
|
|
}
|
|
}
|
|
}
|