Open History to see the last commit
1import { test, expect } from './fixtures'
2
3test('openai -- a middleware wrapFetch header reaches the provider', async ({
4 request,
5 aimockPort,
6 testId,
7}) => {
8 const response = await request.post('/api/wrap-fetch-wire', {
9 data: { testId },
10 })
11 expect(response.ok()).toBe(true)
12 expect(await response.text()).toContain('Stratocaster')
13
14 const journal = await request.get(
15 `http://127.0.0.1:${aimockPort}/v1/_requests`,
16 )
17 const entries = (await journal.json()) as Array<{
18 headers?: Record<string, string>
19 }>
20 const calls = entries.filter(
21 (entry) => entry.headers?.['x-test-id'] === testId,
22 )
23 expect(calls).toHaveLength(1)
24 expect(calls[0]?.headers?.['x-wrap-fetch']).toBe('e2e-trace')
25})