add getFirstHeader method to ElasticsearchResponse
This commit is contained in:
parent
1d06916b07
commit
16ab491016
|
@ -77,6 +77,19 @@ public class ElasticsearchResponse implements Closeable {
|
||||||
return response.getAllHeaders();
|
return response.getAllHeaders();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value of the first header with a specified name of this message.
|
||||||
|
* If there is more than one matching header in the message the first element is returned.
|
||||||
|
* If there is no matching header in the message <code>null</code> is returned.
|
||||||
|
*/
|
||||||
|
public String getFirstHeader(String name) {
|
||||||
|
Header header = response.getFirstHeader(name);
|
||||||
|
if (header == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return header.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the response body available, null otherwise
|
* Returns the response body available, null otherwise
|
||||||
* @see HttpEntity
|
* @see HttpEntity
|
||||||
|
|
Loading…
Reference in New Issue