Skip to content

Commit a0f0850

Browse files
committed
response.Headers.HasKeys() returns false even when response.Headers.AllKeys.Length > 0 :scratchhead:
(cherry picked from commit dca1154) Conflicts: src/Elasticsearch.Net/Connection/HttpWebRequestConnection.cs
1 parent 6df7191 commit a0f0850

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
@@ -162,7 +162,8 @@ public virtual ElasticsearchResponse<TReturn> Request<TReturn>(RequestData reque
162162
builder.StatusCode = (int) response.StatusCode;
163163
builder.Stream = response.GetResponseStream();
164164

165-
if (response.SupportsHeaders && response.Headers.HasKeys() && response.Headers.AllKeys.Contains("Warning"))
165+
//response.Headers.HasKeys() can return false even if response.Headers.AllKeys has values.
166+
if (response.SupportsHeaders && response.Headers.Count > 0 && response.Headers.AllKeys.Contains("Warning"))
166167
builder.DeprecationWarnings = response.Headers.GetValues("Warning");
167168
// https://github.com/elastic/elasticsearch-net/issues/2311
168169
// if stream is null call dispose on response instead.

0 commit comments

Comments
 (0)