Move the colorize stuff from the reporter to utils, use it in
VerboseHttp.
What's there now is merely a demonstration of capabilities, to be
resolved by further discussion.
This makes the class extensible while containing the info in a
visible place.
Also, make sure that the prefix is being called wherever it is
actually used, not using static strings.
Renamed decode_content to decode_response_content for (ever so)
slightly more meaningful name.
More to come.
This add support for the verbose setting to take any single value from
the set: True, False, all, headers, body. "all" and "True" mean show
both headers and body (and anything else we might come up with later).
The code works by making the VerboseHttp class contain all the magic
for verbosity, rather than splitting it in different places. The logic
for making decisions is too messy and could do with some refactoring.
There's logic in place for adding future color and different output
locations (because that was how I made sure the class we encapsulating
well).
A start at getting #69 in shape, but some distance from done.
application/json-home sets a new form of derived media types, but we
should be aware of it. The code is now adjusted to accept it and
anything else that startswith application/json.
Also media types are case insensitive so JSON decoding should
account for that.
We can't rely on there being only one parameter in the content-type,
so we need to do some processing to extract exactly the charset.
Thanks to @ravichandrasadineni for pointing out the problem and
providing a possible solution. This solution differs slightly from
his, but is the same in spirit.
The simple_wsgi app has been updated to return a content-type which
will exercise this code.
Fixes #66
In normal testing setups it is not possible to see the requests and
responses being made. If a test is set to 'verbose: True' then the
test request info and the httplib2 request and response data will be
produced to STDOUT.