Implement new streaming APIs for the `System.Net.Http.Json` extensions (#89258)
authorDavid Pine <david.pine@microsoft.com>
Mon, 24 Jul 2023 16:51:40 +0000 (11:51 -0500)
committerGitHub <noreply@github.com>
Mon, 24 Jul 2023 16:51:40 +0000 (17:51 +0100)
commit08e3814f1011292621b2f0cc377257d313bb04c0
treef91e136bec726a165f6081651a4df7c8beb7a1db
parentc23b0bacd84d559a0c58c5da861a376021e8b967
Implement new streaming APIs for the `System.Net.Http.Json` extensions (#89258)

* Contributes to #87577

* More updates

* Added unit tests, generated ref, and minor clean up

* Added missing triple slash comments

* Update src/libraries/System.Net.Http.Json/tests/FunctionalTests/HttpClientJsonExtensionsTests.cs

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
* Correct the preprocessor directives, and delegate to JsonTypeInfo overload - per peer feedback.

* Refactor for deferred execution, remove helper methods since they're no longer needed

* Add test to ensure deferred execution semantics, updates from Miha.

* Apply suggestions from code review

Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
* Update src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/HttpClientJsonExtensions.Get.AsyncEnumerable.cs

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
* Update test per Miha's feedback

* A few more updates from peer review, Eirik's nits.

* No need for the length limit read stream.

* Add limit per invocation, not element. Share length limit read stream logic.

---------

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
src/libraries/System.Net.Http.Json/ref/System.Net.Http.Json.cs
src/libraries/System.Net.Http.Json/src/System.Net.Http.Json.csproj
src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/HttpClientJsonExtensions.Get.AsyncEnumerable.cs [new file with mode: 0644]
src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/HttpClientJsonExtensions.cs
src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/HttpContentJsonExtensions.AsyncEnumerable.cs [new file with mode: 0644]
src/libraries/System.Net.Http.Json/tests/FunctionalTests/HttpClientJsonExtensionsTests.cs
src/libraries/System.Net.Http.Json/tests/FunctionalTests/HttpContentJsonExtensionsTests.cs
src/libraries/System.Net.Http.Json/tests/FunctionalTests/TestClasses.cs