()
| 15 | }; |
| 16 | |
| 17 | const createTransportCapture = () => { |
| 18 | let capturedOptions; |
| 19 | |
| 20 | const transport = { |
| 21 | request(options, onResponse) { |
| 22 | capturedOptions = options; |
| 23 | |
| 24 | const req = new EventEmitter(); |
| 25 | req.destroyed = false; |
| 26 | req.setTimeout = () => {}; |
| 27 | req.write = () => true; |
| 28 | req.destroy = () => { |
| 29 | req.destroyed = true; |
| 30 | }; |
| 31 | req.close = req.destroy; |
| 32 | req.end = () => { |
| 33 | const res = new PassThrough(); |
| 34 | res.statusCode = 200; |
| 35 | res.statusMessage = 'OK'; |
| 36 | res.headers = { 'content-type': 'application/json' }; |
| 37 | res.req = req; |
| 38 | onResponse(res); |
| 39 | res.end('{"ok":true}'); |
| 40 | }; |
| 41 | |
| 42 | return req; |
| 43 | }, |
| 44 | }; |
| 45 | |
| 46 | return { |
| 47 | transport, |
| 48 | getCapturedOptions: () => capturedOptions, |
| 49 | }; |
| 50 | }; |
| 51 | |
| 52 | describe('headers compat (dist export only)', () => { |
| 53 | it('sends default Accept header', async () => { |
no outgoing calls
no test coverage detected