(req: NextRequest)
| 146 | } |
| 147 | |
| 148 | async function readExecuteRequestBody(req: NextRequest): Promise<unknown> { |
| 149 | assertContentLengthWithinLimit( |
| 150 | req.headers, |
| 151 | MAX_WORKFLOW_EXECUTE_BODY_BYTES, |
| 152 | 'Workflow execution request body' |
| 153 | ) |
| 154 | const buffer = await readStreamToBufferWithLimit(req.body, { |
| 155 | maxBytes: MAX_WORKFLOW_EXECUTE_BODY_BYTES, |
| 156 | label: 'Workflow execution request body', |
| 157 | signal: req.signal, |
| 158 | }) |
| 159 | if (buffer.byteLength === 0) return {} |
| 160 | return JSON.parse(buffer.toString('utf-8')) |
| 161 | } |
| 162 | |
| 163 | function clientCancelledResponse(): NextResponse { |
| 164 | return NextResponse.json({ success: false, error: 'Client cancelled request' }, { status: 499 }) |
no test coverage detected