Skip to content
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

Issue with ODataResponse #15

Open
neerajks opened this issue Mar 19, 2018 · 0 comments
Open

Issue with ODataResponse #15

neerajks opened this issue Mar 19, 2018 · 0 comments

Comments

@neerajks
Copy link

Hi,
First of all let me thank you for a fantastic library.

I recently was using the beta version of the library for a project and got stuck with the following issue.
I have noticed a small issue in ODataResponseMessage GetStreamAsync Method.
dotnetstandard 2 onwards HttpResponseMessage.Content directly supports the ReadAsStreamAsync method. Hence the typecast to StreamContent. The above typecase fails as the response.Content is of type NoWriteNoSeekStreamContent. So propose the following change

As is:

public Task GetStreamAsync()
{
var responseContent = _response.Content as StreamContent;
if (responseContent != null)
{
return responseContent.ReadAsStreamAsync();
}
else
{
var completionSource = new TaskCompletionSource();
completionSource.SetResult(Stream.Null);
return completionSource.Task;
}
}

To be:

public Task GetStreamAsync()
{
var responseContent = _response.Content;
if (responseContent != null)
{
return responseContent.ReadAsStreamAsync();
}
else
{
var completionSource = new TaskCompletionSource();
completionSource.SetResult(Stream.Null);
return completionSource.Task;
}
}

Do let me know your thoughts.
Thanks,
Neeraj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant