linkedin/sepia — pull request #4 by salvipriyanka (2014-02-21 21:03:06+00:00)
Title: Debug support in Sepia

Feature for debugging sepia cache misses. This feature will allow Sepia to search for the best matching request for which a cache miss occurred, so that differences can be known easily & sepia filters can be added.

When fixtures are recorded with debug mode=true, all the incoming requests are saved as '.request' files with the same MD5 hashname calculated for the request.

Later during playback when there is a cache miss, the '.missing' file is compared with all the '.request' files in the same directory as the '.missing file', non-recursively(the .request has to be at the same directory level), for similarity and best matching '.request' fixture filename is provided in the Error thrown by Sepia.

If verbose mode is true, the best matching fixture request is printed in blue in the same format as the cache miss.

====[ cache miss ]====
hashParts: [ [ 'method', 'post' ],
[ 'url', 'https:.mysite.com' ],
[ 'body',
'client_headers=abcabc' ],
[ 'headerNames',
[ 'authorization',
] ],
[ 'cookieNames', [] ] ]
filename:/43cc751a4d1dae7ec149e05b084d7f3d.headers
======================

==== Best matching Fixture ====
to : /43cc751a4d1dae7ec149e05b084d7f3d.missing
filename: /564e11a8776c5b7ddc8ce94e14c5376d.request
hashParts: [ [ 'method', 'post' ],
[ 'url', 'https:.mysite.com' ],
[ 'body',
'client_headers=12345' ],
[ 'headerNames',
[ 'authorization',
] ],
[ 'cookieNames', [] ] ]
======================