req
req copied to clipboard
New step: Log request/response
TBD the naming and output formatting but basically we want to dump the raw request and response for debugging. Something like this:
It's using logger so that users can enable this in tests but also set @tag :capture_log
, i.e. see this only when the tests fail.
HTTPie has interesting options for output formatting:
--print WHAT, -p WHAT
String specifying what the output should contain:
'H' request headers
'B' request body
'h' response headers
'b' response body
'm' response metadata
The default behaviour is 'hb' (i.e., the response
headers and body is printed), if standard output is not redirected.
If the output is piped to another program or to a file, then only the
response body is printed by default.
so we might look into something like that too. Or, we double-down on logger and expose variables to be used by formatting configuration:
"\n$time $metadata[$level] $message\n"
cc @reisub