bug shows what happens if you get an unexpected content-type
from the server. This change is an attempt to at least give it
a clearer error message and make it easier to debug.
It firstly uses the content-type returned by the response to
interpret it, rather than hardcoding application/json. It's
conceivable that wadllib knows how to deal with such a content-type,
so it's better to let it find the error.
The second change catches wadllib's error and throws an error
that explains the situation, so you would get something like
bug shows what happens if you get an unexpected content-type
from the server. This change is an attempt to at least give it
a clearer error message and make it easier to debug.
It firstly uses the content-type returned by the response to
interpret it, rather than hardcoding application/json. It's
conceivable that wadllib knows how to deal with such a content-type,
so it's better to let it find the error.
The second change catches wadllib's error and throws an error
that explains the situation, so you would get something like
https:/ /api.launchpad. net/beta/ ubuntu did not return a usable
content type: This resource doesn't define a representation for
text/html.
with a .content attribute you can print as usual to find out what
you got instead.
I would appreciate some guidance in how to write tests for this
change.
Thanks,
James