Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpResponseException should have getContent() method #143

Closed
wonderfly opened this issue Jan 9, 2015 · 4 comments
Closed

HttpResponseException should have getContent() method #143

wonderfly opened this issue Jan 9, 2015 · 4 comments

Comments

@wonderfly
Copy link
Contributor

@wonderfly wonderfly commented Jan 9, 2015

From roy.hash...@gmail.com on July 26, 2012 10:58:17

Version of google-http-java-client (e.g. 1.5.0-beta)? 1.10 Java environment (e.g. Java 6, Android 2.3, App Engine)? Any Describe the problem. When this exception is thrown, the only way to get the HttpResponse content is to parse the exception message. The format of the exception message is simple but is not documented.

In my case, I need to catch an HttpResponseException that results from an OAuth2 exchange and examine the JSON returned to determine what happened. I have to extract the JSON from the exception message before applying a JSON parser. If the undocumented format of the exception message changes, my code will also break. How would you expect it to be fixed? This could be fixed simply by documenting the format of the String returned by getMessage() and defining it as part of the API. It would be much better, however, to add a getContent() method that returns only the content. This is the strategy recommended in Effective Java Item 10: Always override toString.

Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=143

@wonderfly

This comment has been minimized.

Copy link
Contributor Author

@wonderfly wonderfly commented Jan 9, 2015

From yan...@google.com on October 01, 2012 18:37:42

Status: Accepted
Owner: ngmic...@google.com
Labels: -Type-Defect Type-Enhancement Milestone-Version1.13.0

@wonderfly

This comment has been minimized.

Copy link
Contributor Author

@wonderfly wonderfly commented Jan 9, 2015

From yan...@google.com on December 13, 2012 06:38:11

Labels: -Milestone-Version1.13.0 Milestone-Version1.14.0

@wonderfly

This comment has been minimized.

Copy link
Contributor Author

@wonderfly wonderfly commented Jan 9, 2015

From yan...@google.com on January 11, 2013 19:46:31

https://codereview.appspot.com/7092048/

Status: Started
Owner: yan...@google.com
Cc: ngmic...@google.com
Labels: Component-HTTP

@wonderfly

This comment has been minimized.

Copy link
Contributor Author

@wonderfly wonderfly commented Jan 9, 2015

From yan...@google.com on January 17, 2013 19:11:12

Status: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.