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

Handle multiple paged responses #664

Merged
merged 15 commits into from
Apr 15, 2020

Conversation

pakrym
Copy link
Contributor

@pakrym pakrym commented Apr 15, 2020

Just pick the one with body.

Fixes #625

Filed: Azure/autorest.testserver#169

@pakrym pakrym requested a review from MiYanni April 15, 2020 22:52
@@ -107,7 +107,7 @@ public ClientBuilder(BuildContext context)
nextPageMethods.Add(nextPageMethod);
}

if (!(method.Responses.Single().ResponseBody is ObjectResponseBody objectResponseBody))
if (!(method.Responses.Single(r => r.ResponseBody != null).ResponseBody is ObjectResponseBody objectResponseBody))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this is Single instead of First? Is there not a situation in which 2 different responses return different response bodies?

Also, line 118 has and in the message instead of an.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there not a situation in which 2 different responses return different response bodies?

Never see it.

@pakrym pakrym merged commit 86d6f0e into Azure:feature/v3 Apr 15, 2020
@pakrym pakrym deleted the pakrym/handle-multiple-paged-respons branch April 15, 2020 23:36
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

Successfully merging this pull request may close these issues.

System.InvalidOperationException: Sequence contains more than one element
2 participants