Skip to content

feat(http-recording): BREAKING: update recording to store http status and...

Update recording to store http status and headers along side the body in a json file.

Also eliminates the need to pass a type.

Is not backward compatible at present

Pros

Populates the fake responses with the correct status and headers

Cons

Saves responses are significantly harder to read

Considerations

A custom file format could be devised with custom separators between status, json'd headers, and raw body. But that would require discussion.

Expand for example

"Meta" at the top, and raw body at the bottom. __RESPONSE_BODY__ being a bad example of the custom separator 0_my_test_name.txt

{
  "status": 200,
  "headers": {
    "x-dt-tracestate": [
      "2657029b-d60b1792@dt"
    ],
    "Accept": [
      "application\/json"
    ],
    "traceresponse": [
      "00-d00653e6d62ad165fa35e2d8473e3584-4f655e7369433a36-01"
    ],
    "Content-Type": [
      "application\/json; charset=UTF-8"
    ],
    "Content-Length": [
      "1459"
    ]
  }
}
__RESPONSE_BODY__
<html>
  <head>
    <title>Example</title>
  </head>
  <body>
    <p>Lorem ipsum.</p>
  <body>
</html>
Edited by Rick Hambrook

Merge request reports