make status message available on response #362

Merged
merged 1 commit into from Mar 7, 2013

2 participants

@NetForce1

It would be nice to have the status message available on the reponse

@fernandezpablo85 fernandezpablo85 commented on the diff Mar 1, 2013
src/main/java/org/scribe/model/Response.java
@@ -87,6 +89,17 @@ public int getCode()
{
return code;
}
+
+ /**
+ * Obtains the HTTP status message.
+ * Returns <code>null</code> if the message can not be discerned from the response (not valid HTTP)
@fernandezpablo85
fernandezpablo85 added a line comment Mar 1, 2013

I'm a bit reluctant to returning null, wouldn't it be better to check for nulls and return ""?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@fernandezpablo85 fernandezpablo85 merged commit ad55e22 into scribejava:master Mar 7, 2013

1 check passed

Details default The Travis build passed
@NetForce1

Thanks, about the null-issue, I just copied that from URLConnection. Currently I don't have strong opinions one way or the other.

@fernandezpablo85

I gave it a second thought and getting null is not semantically the same as an empty string. In this case it's fine to return null to be consistent with the underlying implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment