More middleware typing (pls)
This commit is contained in:
parent
10c1c18f16
commit
862fcee0b4
|
@ -1,6 +1,7 @@
|
|||
import { Header } from "../constants"
|
||||
import { buildMatcherRegex, matches } from "./matchers"
|
||||
import { Ctx, EndpointMatcher } from "@budibase/types"
|
||||
import { Middleware, Next } from "koa"
|
||||
|
||||
/**
|
||||
* GET, HEAD and OPTIONS methods are considered safe operations
|
||||
|
@ -36,7 +37,7 @@ export default function (
|
|||
opts: { noCsrfPatterns: EndpointMatcher[] } = { noCsrfPatterns: [] }
|
||||
) {
|
||||
const noCsrfOptions = buildMatcherRegex(opts.noCsrfPatterns)
|
||||
return async (ctx: Ctx, next: any) => {
|
||||
return (async (ctx: Ctx, next: Next) => {
|
||||
// don't apply for excluded paths
|
||||
const found = matches(ctx, noCsrfOptions)
|
||||
if (found) {
|
||||
|
@ -77,5 +78,5 @@ export default function (
|
|||
}
|
||||
|
||||
return next()
|
||||
}
|
||||
}) as Middleware
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue