(req)
| 34 | const server = Bun.serve({ |
| 35 | port: 0, // random port |
| 36 | async fetch(req) { |
| 37 | const body = await req.text(); |
| 38 | let parsed: any = body; |
| 39 | try { parsed = JSON.parse(body); } catch { /* leave as text */ } |
| 40 | requests.push({ |
| 41 | method: req.method, |
| 42 | url: new URL(req.url).pathname, |
| 43 | authorization: req.headers.get('Authorization'), |
| 44 | contentType: req.headers.get('Content-Type'), |
| 45 | body: parsed, |
| 46 | }); |
| 47 | return new Response(response.body, { status: response.status }); |
| 48 | }, |
| 49 | }); |
| 50 | |
| 51 | return { |