Skip to content

Commit dca1154

Browse files
committed
response.Headers.HasKeys() returns false even when response.Headers.AllKeys.Length > 0 :scratchhead:
1 parent d6cc919 commit dca1154

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Elasticsearch.Net/Connection/HttpWebRequestConnection.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ public virtual TResponse Request<TResponse>(RequestData requestData)
165165
var response = (HttpWebResponse) request.GetResponse();
166166
HandleResponse(response, out statusCode, out responseStream, out mimeType);
167167

168-
if (response.SupportsHeaders && response.Headers.HasKeys() && response.Headers.AllKeys.Contains("Warning"))
168+
//response.Headers.HasKeys() can return false even if response.Headers.AllKeys has values.
169+
if (response.SupportsHeaders && response.Headers.Count > 0 && response.Headers.AllKeys.Contains("Warning"))
169170
warnings = response.Headers.GetValues("Warning");
170171
}
171172
catch (WebException e)

0 commit comments

Comments
 (0)