diff options
author | Elizabeth Alexander Hunt <me@liz.coffee> | 2025-05-18 22:54:15 -0700 |
---|---|---|
committer | Elizabeth Alexander Hunt <me@liz.coffee> | 2025-05-18 22:55:20 -0700 |
commit | d54e91c6582ed160cf2f2fcf977e48b4439d133b (patch) | |
tree | 5669367c4fa49bc0373b0c581ea3027218fd5e32 /u/server/filter/method.ts | |
parent | 9cf3fc0259730b7dcf47b3ab4a04369e39fb4614 (diff) | |
download | ci-theBigRefactor.tar.gz ci-theBigRefactor.zip |
snapshottheBigRefactor
Diffstat (limited to 'u/server/filter/method.ts')
-rw-r--r-- | u/server/filter/method.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/u/server/filter/method.ts b/u/server/filter/method.ts index 350f04c..6b0419d 100644 --- a/u/server/filter/method.ts +++ b/u/server/filter/method.ts @@ -1,8 +1,8 @@ import { Either, type ITraceable, - JsonResponse, LogLevel, + PenguenoError, type PenguenoRequest, type RequestFilter, type ServerTrace, @@ -22,7 +22,7 @@ type HttpMethod = export const requireMethod = ( methods: Array<HttpMethod>, -): RequestFilter<HttpMethod, JsonResponse> => +): RequestFilter<HttpMethod> => (req: ITraceable<PenguenoRequest, ServerTrace>) => req.bimap(TraceUtil.withFunctionTrace(requireMethod)) .move(Promise.resolve(req.get())) @@ -32,10 +32,10 @@ export const requireMethod = ( if (!methods.includes(method)) { const msg = "that's not how you pet me (âīšâ)~"; t.trace.addTrace(LogLevel.WARN).trace(msg); - return Either.left<JsonResponse, HttpMethod>( - new JsonResponse(req, msg, { status: 405 }), + return Either.left<PenguenoError, HttpMethod>( + new PenguenoError(msg, 405), ); } - return Either.right<JsonResponse, HttpMethod>(method); + return Either.right<PenguenoError, HttpMethod>(method); })) .get(); |