Skip to content
Myr

fix(context): revert PR #4707 (#4757)

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 5cc8f8f · Browse files · 1 file+7 added−15 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−15 removed

  • other:+7 added−15 removed

1 file+7 added−15 removed

modified:src/context.ts+7 added-15 removed
665 unmodified lines
666 arg?: StatusCode | RequestInit,667 headers?: HeaderRecord668 ): ReturnType<BodyRespond> => this.#newResponse(data, arg, headers) as ReturnType<BodyRespond>669670 #useFastPath(): boolean {671 return !this.#preparedHeaders && !this.#status && !this.finalized672 }673670 /**671 * `.text()` can render text as `Content-Type:text/plain`.672 *673 * @see {@link https://hono.dev/docs/api/context#text}
9 unmodified lines
683 text: string,684 arg?: ContentfulStatusCode | ResponseOrInit,685 headers?: HeaderRecord686 ): ReturnType<TextRespond> => {691 return this.#useFastPath() && !arg && !headers692 ? (createResponseInstance(text) as ReturnType<TextRespond>)687 return !this.#preparedHeaders && !this.#status && !arg && !headers && !this.finalized688 ? (new Response(text) as ReturnType<TextRespond>)689 : (this.#newResponse(690 text,691 arg,692 setDefaultContentType(TEXT_PLAIN, headers)
19 unmodified lines
712 object: T,713 arg?: U | ResponseOrInit<U>,714 headers?: HeaderRecord715 ): JSONRespondReturn<T, U> => {720 return (721 this.#useFastPath() && !arg && !headers722 ? Response.json(object)723 : this.#newResponse(724 JSON.stringify(object),725 arg,726 setDefaultContentType('application/json', headers)727 )716 return this.#newResponse(717 JSON.stringify(object),718 arg,719 setDefaultContentType('application/json', headers)720 ) /* eslint-disable @typescript-eslint/no-explicit-any */ as any728 ) as JSONRespondReturn<T, U>721 }722723 html: HTMLRespond = (724 html: string | Promise<string>,
56 unmodified lines