chore: denoify
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Yusuke Wada · committed by Yusuke Wada · parent 6d0da56 · Browse files · 4 files·+6 added−7 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+6 added−7 removed
- other:+6 added−7 removed
Provenance
- Commit
33f1cbd- Tree
5faef38- Author
Yusuke Wada <yusuke@kamawada.com>- Committer
Yusuke Wada <yusuke@kamawada.com>- Parent
6d0da56
4 files changed+6 added−7 removed
modified:deno_dist/middleware/basic-auth/index.ts+1 added-2 removed
51 unmodified lines525354555656575859606162626351 unmodified lines return } } } ctx.res = new Response('Unauthorized', { return new Response('Unauthorized', { status: 401, headers: { 'WWW-Authenticate': 'Basic realm="' + options.realm?.replace(/"/g, '\\"') + '"', }, }) await next() }}modified:deno_dist/middleware/bearer-auth/index.ts+3 added-3 removed
25 unmodified lines262728293030313233342 unmodified lines3738394041414243444546474849505151525354557 unmodified lines25 unmodified lines const headerToken = c.req.headers.get('Authorization')
if (!headerToken) { // No Authorization header c.res = new Response('Unauthorized', { return new Response('Unauthorized', { status: 401, headers: { 'WWW-Authenticate': `${options.prefix} realm="` + realm + '"', },2 unmodified lines const regexp = new RegExp('^' + options.prefix + ' +(' + TOKEN_STRINGS + ') *$') const match = regexp.exec(headerToken) if (!match) { // Invalid Request c.res = new Response('Bad Request', { return new Response('Bad Request', { status: 400, headers: { 'WWW-Authenticate': `${options.prefix} error="invalid_request"`, }, }) } else { const equal = await timingSafeEqual(options.token, match[1], options.hashFunction) if (!equal) { // Invalid Token c.res = new Response('Unauthorized', { return new Response('Unauthorized', { status: 401, headers: { 'WWW-Authenticate': `${options.prefix} error="invalid_token"`, },7 unmodified linesmodified:deno_dist/utils/encode.ts+1 added-1 removed
1-import { Buffer } from "https://deno.land/std@0.159.0/node/buffer.ts";1+import { Buffer } from "https://deno.land/std@0.160.0/node/buffer.ts";2 export const encodeBase64 = (str: string): string => {3 if (str === null) {4 throw new TypeError('1st argument of "encodeBase64" should not be null.')5 }72 unmodified linesmodified:deno_dist/hono.ts+1 added-1 removed
27 unmodified lines28 D extends ValidatedData = ValidatedData29 > = (30 c: Context<RequestParamKeyType, E, D>,31 next: Next32-) => Response | Promise<Response> | Promise<void> | Promise<Response | undefined>32+) => Response | Promise<Response> | Promise<void> | Promise<Response | undefined | void>33 34 export type MiddlewareHandler = <E extends Partial<Environment> = Environment>(35 c: Context<string, E>,36 next: Next250 unmodified lines