Allow reading of response headers from HttpDataSource implementations

This commit is contained in:
Oliver Woodman 2015-06-12 17:36:48 +01:00
parent 3661726401
commit bdd1968abe
2 changed files with 12 additions and 0 deletions

View File

@ -152,6 +152,11 @@ public class DefaultHttpDataSource implements HttpDataSource {
return connection == null ? null : connection.getURL().toString();
}
@Override
public Map<String, List<String>> getResponseHeaders() {
return connection == null ? null : connection.getHeaderFields();
}
@Override
public void setRequestProperty(String name, String value) {
Assertions.checkNotNull(name);

View File

@ -145,4 +145,11 @@ public interface HttpDataSource extends UriDataSource {
*/
void clearAllRequestProperties();
/**
* Gets the headers provided in the response.
*
* @return The response headers, or {@code null} if response headers are unavailable.
*/
Map<String, List<String>> getResponseHeaders();
}