joshgontijo / rest-client

MIT License
21 stars 5 forks source link

[Feature request] Allow reusing the original request even if asObject has failed #60

Closed joshgontijo closed 6 years ago

joshgontijo commented 7 years ago

From #113

Suppose I do a request, and use asObject(MyObject.class), and this fails. I can't do anything anymore with the response if parsing has failed which makes this method useless to me. I have to resort to parsing it myself using jackson or gson in order to avoid doing a second request just to reparse it.

It should somehow be possible to provide an alternative strategy to apply if the first one fails.

joshgontijo commented 6 years ago

This issue can be avoided by registering the appropriate mapper for the response. The body is parsed based upon the content negotiation.