@@ -667,10 +667,6 @@ export class Context<
667667 headers ?: HeaderRecord
668668 ) : ReturnType < BodyRespond > => this . #newResponse( data , arg , headers ) as ReturnType < BodyRespond >
669669
670- #useFastPath( ) : boolean {
671- return ! this . #preparedHeaders && ! this . #status && ! this . finalized
672- }
673-
674670 /**
675671 * `.text()` can render text as `Content-Type:text/plain`.
676672 *
@@ -688,8 +684,8 @@ export class Context<
688684 arg ?: ContentfulStatusCode | ResponseOrInit ,
689685 headers ?: HeaderRecord
690686 ) : ReturnType < TextRespond > => {
691- return this . #useFastPath ( ) && ! arg && ! headers
692- ? ( createResponseInstance ( text ) as ReturnType < TextRespond > )
687+ return ! this . #preparedHeaders && ! this . #status && ! arg && ! headers && ! this . finalized
688+ ? ( new Response ( text ) as ReturnType < TextRespond > )
693689 : ( this . #newResponse(
694690 text ,
695691 arg ,
@@ -717,15 +713,11 @@ export class Context<
717713 arg ?: U | ResponseOrInit < U > ,
718714 headers ?: HeaderRecord
719715 ) : JSONRespondReturn < T , U > => {
720- return (
721- this . #useFastPath( ) && ! arg && ! headers
722- ? Response . json ( object )
723- : this . #newResponse(
724- JSON . stringify ( object ) ,
725- arg ,
726- setDefaultContentType ( 'application/json' , headers )
727- )
728- ) as JSONRespondReturn < T , U >
716+ return this . #newResponse(
717+ JSON . stringify ( object ) ,
718+ arg ,
719+ setDefaultContentType ( 'application/json' , headers )
720+ ) /* eslint-disable @typescript-eslint/no-explicit-any */ as any
729721 }
730722
731723 html : HTMLRespond = (
0 commit comments