File tree Expand file tree Collapse file tree
starter/api/rest/src/view/rest/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -129,19 +129,21 @@ const asyncHandler =
129129 < TRes > ( fn : ApiHandler < TRes > , operationId ?: OperationIds ) : express . Handler =>
130130 async ( req , res , next ) => {
131131 try {
132- const result = await fn ( req . context , req , res )
133-
134- if ( operationId && ! res . headersSent ) {
132+ if ( operationId ) {
135133 const metadata = operationPaths [ operationId ]
136134 if ( metadata ?. successStatus ) {
137135 res . status ( metadata . successStatus )
138136 }
139137 }
140138
141- if ( result != undefined ) {
142- res . json ( result )
143- } else {
144- res . end ( )
139+ const result = await fn ( req . context , req , res )
140+
141+ if ( ! res . headersSent ) {
142+ if ( result != undefined ) {
143+ res . json ( result )
144+ } else {
145+ res . end ( )
146+ }
145147 }
146148 } catch ( error : unknown ) {
147149 next ( error )
You canāt perform that action at this time.
0 commit comments