Skip to content

Commit

Permalink
make status message available on response
Browse files Browse the repository at this point in the history
  • Loading branch information
NetForce1 committed Mar 1, 2013
1 parent 86f12eb commit 9b6a5ec
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/org/scribe/model/Response.java
Expand Up @@ -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<String, String> headers;
Expand All @@ -27,6 +28,7 @@ public class Response
{
connection.connect();
code = connection.getResponseCode();
message = connection.getResponseMessage();
headers = parseHeaders(connection);
stream = isSuccessful() ? connection.getInputStream() : connection.getErrorStream();
}
Expand Down Expand Up @@ -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)
*
* @return the status message
*/
public String getMessage()
{
return message;
}

/**
* Obtains a {@link Map} containing the HTTP Response Headers
Expand Down

0 comments on commit 9b6a5ec

Please sign in to comment.