| 491 | * `sendStatus`), or when the call is not one of these. |
| 492 | */ |
| 493 | export function implicitResponseStatus(text: string): number | null { |
| 494 | const call = normaliseCall(text); |
| 495 | if (/(?:^|\.)(?:status|sendStatus|code|Status|StatusCode|SendStatus|withStatus|with_status|writeHead)\(/.test(call)) return null; |
| 496 | const bare = call.replace(/\([^()]*\)/g, ''); |
| 497 | if (/^(?:res|response|reply|rep|ctx|c|context)(?:\.(?:type|set|header|headers|append|cookie|clearCookie|vary|location|links|format))*\.(?:json|jsonp|send|render|sendFile|download|text|html|body|stream|file|view)$/.test(bare)) return 200; |
| 498 | if (/^(?:NextResponse|Response)\.json$/.test(bare)) return 200; |
| 499 | if (/^(?:JSONResponse|HTMLResponse|PlainTextResponse|ORJSONResponse|UJSONResponse|jsonify|render_template|render|make_response|HttpResponse|JsonResponse|send_file|send_from_directory)$/.test(bare)) return 200; |
| 500 | if (/^(?:render|render_to_string|respond_with)$/.test(bare)) return 200; |
| 501 | if (/^ModelAndView$/.test(bare)) return 200; |
| 502 | if (/^response\(\)->(?:json|view)$|^response->json$|^view$/.test(call.replace(/\s+/g, ''))) return 200; |
| 503 | return null; |
| 504 | } |
| 505 | |
| 506 | /** The abbreviated argument list split on its top-level commas. */ |
| 507 | function splitArgs(args: string): string[] { |