fix: don't use `defaultNotFoundMessage` variable (#549)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Yusuke Wada · committed by GitHub · parent e934bb2 · Browse files · 4 files·+4 added−12 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+4 added−12 removed
- other:+4 added−12 removed
Provenance
- Commit
7bb9cc1- Tree
9253aff- Author
Yusuke Wada <yusuke@kamawada.com>- Committer
GitHub <noreply@github.com>- Parent
e934bb2
4 files changed+4 added−12 removed
modified:deno_dist/context.ts+1 added-2 removed
3 unmodified lines4 ContextVariableMap,5 Bindings,6 ValidatedData,7 } from './hono.ts'8-import { defaultNotFoundMessage } from './hono.ts'8 import type { CookieOptions } from './utils/cookie.ts'9 import { serialize } from './utils/cookie.ts'10 import type { StatusCode } from './utils/http-status.ts'11 86 unmodified lines98 }99 }100 101 get res(): Response {103- return (this._res ||= new Response(defaultNotFoundMessage, { status: 404 }))102+ return (this._res ||= new Response('404 Not Found', { status: 404 }))103 }104 105 set res(_res: Response) {106 this._res = _res130 unmodified linesmodified:deno_dist/hono.ts+1 added-4 removed
45 unmodified lines46 ) => Response47 48 export type Next = () => Promise<void>49 50-export const defaultNotFoundMessage = '404 Not Found'51-50 // eslint-disable-next-line @typescript-eslint/no-unused-vars51 type ParamKeyName<NameWithPattern> = NameWithPattern extends `${infer Name}{${infer _Pattern}`52 ? Name53 : NameWithPattern91 unmodified lines145 Object.assign(this, init)146 }147 148 private notFoundHandler: NotFoundHandler<E> = (c: Context<string, E>) => {151- const message = defaultNotFoundMessage152- return c.text(message, 404)149+ return c.text('404 Not Found', 404)150 }151 152 private errorHandler: ErrorHandler<E> = (err: Error, c: Context<string, E>) => {153 console.error(`${err.stack || err.message}`)128 unmodified linesmodified:src/context.ts+1 added-2 removed
3 unmodified lines4 ContextVariableMap,5 Bindings,6 ValidatedData,7 } from './hono'8-import { defaultNotFoundMessage } from './hono'8 import type { CookieOptions } from './utils/cookie'9 import { serialize } from './utils/cookie'10 import type { StatusCode } from './utils/http-status'11 86 unmodified lines98 }99 }100 101 get res(): Response {103- return (this._res ||= new Response(defaultNotFoundMessage, { status: 404 }))102+ return (this._res ||= new Response('404 Not Found', { status: 404 }))103 }104 105 set res(_res: Response) {106 this._res = _res130 unmodified linesmodified:src/hono.ts+1 added-4 removed
45 unmodified lines46 ) => Response47 48 export type Next = () => Promise<void>49 50-export const defaultNotFoundMessage = '404 Not Found'51-50 // eslint-disable-next-line @typescript-eslint/no-unused-vars51 type ParamKeyName<NameWithPattern> = NameWithPattern extends `${infer Name}{${infer _Pattern}`52 ? Name53 : NameWithPattern91 unmodified lines145 Object.assign(this, init)146 }147 148 private notFoundHandler: NotFoundHandler<E> = (c: Context<string, E>) => {151- const message = defaultNotFoundMessage152- return c.text(message, 404)149+ return c.text('404 Not Found', 404)150 }151 152 private errorHandler: ErrorHandler<E> = (err: Error, c: Context<string, E>) => {153 console.error(`${err.stack || err.message}`)128 unmodified lines