(expectation, requestBodySanitizer, responseBodySanitizer)
| 32 | ].map(h => h.toLowerCase()); |
| 33 | |
| 34 | const transformRecordedData = (expectation, requestBodySanitizer, responseBodySanitizer) => { |
| 35 | const { httpRequest, httpResponse } = expectation; |
| 36 | |
| 37 | const responseHeaders = {}; |
| 38 | |
| 39 | Object.keys(httpResponse.headers) |
| 40 | .filter(key => !HEADERS_TO_IGNORE.includes(key.toLowerCase())) |
| 41 | .forEach(key => { |
| 42 | responseHeaders[key] = httpResponse.headers[key][0]; |
| 43 | }); |
| 44 | |
| 45 | let queryString; |
| 46 | if (httpRequest.queryStringParameters) { |
| 47 | const { queryStringParameters } = httpRequest; |
| 48 | |
| 49 | queryString = Object.keys(queryStringParameters) |
| 50 | .map(key => `${key}=${queryStringParameters[key]}`) |
| 51 | .join('&'); |
| 52 | } |
| 53 | |
| 54 | const body = requestBodySanitizer(httpRequest); |
| 55 | const responseBody = responseBodySanitizer(httpRequest, httpResponse); |
| 56 | |
| 57 | const cypressRouteOptions = { |
| 58 | body, |
| 59 | method: httpRequest.method, |
| 60 | url: queryString ? `${httpRequest.path}?${queryString}` : httpRequest.path, |
| 61 | headers: responseHeaders, |
| 62 | response: responseBody, |
| 63 | status: httpResponse.statusCode, |
| 64 | }; |
| 65 | |
| 66 | return cypressRouteOptions; |
| 67 | }; |
| 68 | |
| 69 | function getGitClient(repoDir) { |
| 70 | const git = simpleGit(repoDir).env({ ...process.env, GIT_SSH_COMMAND, GIT_SSL_NO_VERIFY }); |
nothing calls this directly
no test coverage detected