(path = '/steal', responseBody = JSON.stringify({result: 'ok'}))
| 25 | }; |
| 26 | |
| 27 | export const createCrossOriginReceiver = async (path = '/steal', responseBody = JSON.stringify({result: 'ok'})) => { |
| 28 | const server = await createHttpTestServer({bodyParser: false}); |
| 29 | const received = { |
| 30 | authorization: undefined as string | undefined, |
| 31 | cookie: undefined as string | undefined, |
| 32 | body: '', |
| 33 | contentType: undefined as string | undefined, |
| 34 | }; |
| 35 | |
| 36 | server.post(path, async (request, response) => { |
| 37 | received.authorization = request.headers.authorization; |
| 38 | received.cookie = request.headers.cookie; |
| 39 | received.body = await getStream(request); |
| 40 | received.contentType = request.headers['content-type']; |
| 41 | response.end(responseBody); |
| 42 | }); |
| 43 | |
| 44 | server.get(path, (request, response) => { |
| 45 | received.authorization = request.headers.authorization; |
| 46 | received.cookie = request.headers.cookie; |
| 47 | received.contentType = request.headers['content-type']; |
| 48 | response.end(responseBody); |
| 49 | }); |
| 50 | |
| 51 | return {server, received}; |
| 52 | }; |
| 53 | |
| 54 | export const createRetryUrlServer = async (retryUrl: string, responsePath = '/api') => { |
| 55 | const server = await createHttpTestServer(); |
no test coverage detected
searching dependent graphs…