diff options
author | Elizabeth Hunt <me@liz.coffee> | 2025-07-27 18:50:33 -0700 |
---|---|---|
committer | Elizabeth Hunt <me@liz.coffee> | 2025-07-27 19:31:06 -0700 |
commit | 7aa11b7a8abacf81dec20fff21216df35d333756 (patch) | |
tree | 40f6a76c37412cf1c5a67f99a4ee30e3aae863c9 /u/server/filter/method.ts | |
parent | e4df72cd446270cf867ec308995a05e21b3aa601 (diff) | |
download | ci-7aa11b7a8abacf81dec20fff21216df35d333756.tar.gz ci-7aa11b7a8abacf81dec20fff21216df35d333756.zip |
Pulls in pengueno from npm
Diffstat (limited to 'u/server/filter/method.ts')
-rw-r--r-- | u/server/filter/method.ts | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/u/server/filter/method.ts b/u/server/filter/method.ts deleted file mode 100644 index 7d6aa76..0000000 --- a/u/server/filter/method.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { - Either, - HttpMethod, - IEither, - type ITraceable, - LogLevel, - PenguenoError, - type PenguenoRequest, - type RequestFilter, - type ServerTrace, - TraceUtil, -} from '@emprespresso/pengueno'; - -export const requireMethod = - (methods: Array<HttpMethod>): RequestFilter<HttpMethod> => - (req: ITraceable<PenguenoRequest, ServerTrace>) => - req - .flatMap(TraceUtil.withFunctionTrace(requireMethod)) - .map((t): IEither<PenguenoError, HttpMethod> => { - const { - req: { method }, - } = t.get(); - if (!methods.includes(method)) { - const msg = "that's not how you pet me (âīšâ)~"; - t.trace.traceScope(LogLevel.WARN).trace(msg); - return Either.left(new PenguenoError(msg, 405)); - } - return Either.right(method); - }) - .get(); |