(source = {}, target = {}, url = '')
| 41 | * Compare whether tow object are equal |
| 42 | */ |
| 43 | function isObjectEqual(source = {}, target = {}, url = '') { |
| 44 | source = Object.assign({}, source); |
| 45 | target = Object.assign({}, target); |
| 46 | let isEqual = true; |
| 47 | |
| 48 | for (const key in source) { |
| 49 | isEqual = isEqual && _isDeepEqual(source[key], target[key]); |
| 50 | |
| 51 | if (!isEqual) { |
| 52 | console.info('source object :', source); |
| 53 | console.info('target object :', target); |
| 54 | printError(`different key in isObjectEqual is: "${key}", source is "${source[key]}", |
| 55 | target is "${target[key]}" the url is ${url}`); |
| 56 | break; |
| 57 | } |
| 58 | |
| 59 | delete source[key]; |
| 60 | delete target[key]; |
| 61 | } |
| 62 | |
| 63 | for (const key in target) { |
| 64 | isEqual = isEqual && source[key] === target[key]; |
| 65 | |
| 66 | if (!isEqual) { |
| 67 | console.info('source object :', source); |
| 68 | console.info('target object :', target); |
| 69 | printError(`different key in isObjectEqual is: "${key}", source is "${source[key]}", |
| 70 | target is "${target[key]}" the url is ${url}`); |
| 71 | break; |
| 72 | } |
| 73 | |
| 74 | delete source[key]; |
| 75 | delete target[key]; |
| 76 | } |
| 77 | |
| 78 | return isEqual; |
| 79 | } |
| 80 | |
| 81 | /* |
| 82 | * Compare the header between direct with proxy |
no test coverage detected