(config)
| 38 | }); |
| 39 | |
| 40 | const requestWithConfig = async (config) => { |
| 41 | server = await startServer((req, res) => { |
| 42 | res.setHeader('Content-Type', 'text/plain'); |
| 43 | res.end(req.headers.authorization || ''); |
| 44 | }); |
| 45 | |
| 46 | const { port } = server.address(); |
| 47 | |
| 48 | return axios.get( |
| 49 | `http://127.0.0.1:${port}/`, |
| 50 | Object.assign( |
| 51 | { |
| 52 | proxy: false, |
| 53 | }, |
| 54 | config || {} |
| 55 | ) |
| 56 | ); |
| 57 | }; |
| 58 | |
| 59 | it('sets Basic Authorization header from auth credentials', async () => { |
| 60 | const response = await requestWithConfig({ |
no test coverage detected