Skip to content

Commit 9b6a5ec

Browse files
committed
make status message available on response
1 parent 86f12eb commit 9b6a5ec

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/main/java/org/scribe/model/Response.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class Response
1717
private static final String EMPTY = "";
1818

1919
private int code;
20+
private String message;
2021
private String body;
2122
private InputStream stream;
2223
private Map<String, String> headers;
@@ -27,6 +28,7 @@ public class Response
2728
{
2829
connection.connect();
2930
code = connection.getResponseCode();
31+
message = connection.getResponseMessage();
3032
headers = parseHeaders(connection);
3133
stream = isSuccessful() ? connection.getInputStream() : connection.getErrorStream();
3234
}
@@ -87,6 +89,17 @@ public int getCode()
8789
{
8890
return code;
8991
}
92+
93+
/**
94+
* Obtains the HTTP status message.
95+
* Returns <code>null</code> if the message can not be discerned from the response (not valid HTTP)
96+
*
97+
* @return the status message
98+
*/
99+
public String getMessage()
100+
{
101+
return message;
102+
}
90103

91104
/**
92105
* Obtains a {@link Map} containing the HTTP Response Headers

0 commit comments

Comments
 (0)