Skip to content

Fix handling of return types. #1887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Elasticsearch.Net/Transport/Pipeline/ResponseBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ private bool SetSpecialTypes(Stream responseStream, ElasticsearchResponse<TRetur
var setSpecial = true;
if (this._requestData.ConnectionSettings.DisableDirectStreaming)
cs.ResponseBodyInBytes = bytes;

if (cs.Body is string)
var returnType = typeof (TReturn);
if (returnType == typeof(string))
this.SetStringResult(cs as ElasticsearchResponse<string>, bytes);
else if (cs.Body is byte[])
else if (returnType == typeof(byte[]))
this.SetByteResult(cs as ElasticsearchResponse<byte[]>, bytes);
else if (cs.Body is VoidResponse)
else if (returnType == typeof(VoidResponse))
this.SetVoidResult(cs as ElasticsearchResponse<VoidResponse>, responseStream);
else if (cs.Body is Stream)
this.SetStreamResult(cs as ElasticsearchResponse<Stream>, responseStream);
else if (returnType == typeof(Stream))
this.SetStreamResult(cs as ElasticsearchResponse<Stream>, responseStream);
else
setSpecial = false;
return setSpecial;
Expand Down