Skip to content
Myr

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

4 files+4 added−12 removed

modified:deno_dist/context.ts+1 added-2 removed
3 unmodified lines
4 ContextVariableMap,5 Bindings,6 ValidatedData,7} from './hono.ts'8import { defaultNotFoundMessage } from './hono.ts'8import type { CookieOptions } from './utils/cookie.ts'9import { serialize } from './utils/cookie.ts'10import type { StatusCode } from './utils/http-status.ts'11
86 unmodified lines
98 }99 }100101 get res(): Response {103 return (this._res ||= new Response(defaultNotFoundMessage, { status: 404 }))102 return (this._res ||= new Response('404 Not Found', { status: 404 }))103 }104105 set res(_res: Response) {106 this._res = _res
130 unmodified lines
modified:deno_dist/hono.ts+1 added-4 removed
45 unmodified lines
46) => Response4748export type Next = () => Promise<void>4950export const defaultNotFoundMessage = '404 Not Found'5150// eslint-disable-next-line @typescript-eslint/no-unused-vars51type ParamKeyName<NameWithPattern> = NameWithPattern extends `${infer Name}{${infer _Pattern}`52 ? Name53 : NameWithPattern
91 unmodified lines
145 Object.assign(this, init)146 }147148 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 }151152 private errorHandler: ErrorHandler<E> = (err: Error, c: Context<string, E>) => {153 console.error(`${err.stack || err.message}`)
128 unmodified lines
modified:src/context.ts+1 added-2 removed
3 unmodified lines
4 ContextVariableMap,5 Bindings,6 ValidatedData,7} from './hono'8import { defaultNotFoundMessage } from './hono'8import type { CookieOptions } from './utils/cookie'9import { serialize } from './utils/cookie'10import type { StatusCode } from './utils/http-status'11
86 unmodified lines
98 }99 }100101 get res(): Response {103 return (this._res ||= new Response(defaultNotFoundMessage, { status: 404 }))102 return (this._res ||= new Response('404 Not Found', { status: 404 }))103 }104105 set res(_res: Response) {106 this._res = _res
130 unmodified lines
modified:src/hono.ts+1 added-4 removed
45 unmodified lines
46) => Response4748export type Next = () => Promise<void>4950export const defaultNotFoundMessage = '404 Not Found'5150// eslint-disable-next-line @typescript-eslint/no-unused-vars51type ParamKeyName<NameWithPattern> = NameWithPattern extends `${infer Name}{${infer _Pattern}`52 ? Name53 : NameWithPattern
91 unmodified lines
145 Object.assign(this, init)146 }147148 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 }151152 private errorHandler: ErrorHandler<E> = (err: Error, c: Context<string, E>) => {153 console.error(`${err.stack || err.message}`)
128 unmodified lines