diff --git a/src/main/java/org/scribe/model/Response.java b/src/main/java/org/scribe/model/Response.java index 9835a05a6..d433922c6 100644 --- a/src/main/java/org/scribe/model/Response.java +++ b/src/main/java/org/scribe/model/Response.java @@ -17,6 +17,7 @@ public class Response private static final String EMPTY = ""; private int code; + private String message; private String body; private InputStream stream; private Map headers; @@ -27,6 +28,7 @@ public class Response { connection.connect(); code = connection.getResponseCode(); + message = connection.getResponseMessage(); headers = parseHeaders(connection); stream = isSuccessful() ? connection.getInputStream() : connection.getErrorStream(); } @@ -87,6 +89,17 @@ public int getCode() { return code; } + + /** + * Obtains the HTTP status message. + * Returns null if the message can not be discerned from the response (not valid HTTP) + * + * @return the status message + */ + public String getMessage() + { + return message; + } /** * Obtains a {@link Map} containing the HTTP Response Headers