(
request: Request,
env: Env,
ctx: ExecutionContext
)
| 323 | * Main handler for Git protocol requests |
| 324 | */ |
| 325 | export async function handleGitProtocolRequest( |
| 326 | request: Request, |
| 327 | env: Env, |
| 328 | ctx: ExecutionContext |
| 329 | ): Promise<Response> { |
| 330 | const url = new URL(request.url); |
| 331 | const pathname = url.pathname; |
| 332 | |
| 333 | // Extract app ID |
| 334 | const appId = extractAppId(pathname); |
| 335 | if (!appId) { |
| 336 | return new Response('Invalid Git URL', { status: 400 }); |
| 337 | } |
| 338 | |
| 339 | // Route to appropriate handler |
| 340 | if (GIT_INFO_REFS_PATTERN.test(pathname)) { |
| 341 | return handleInfoRefs(request, env, ctx, appId); |
| 342 | } else if (GIT_UPLOAD_PACK_PATTERN.test(pathname)) { |
| 343 | return handleUploadPack(request, env, ctx, appId); |
| 344 | } |
| 345 | |
| 346 | return new Response('Not found', { status: 404 }); |
| 347 | } |
no test coverage detected