-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
raise IncompleteReadError if only receive partial response #20888
Merged
Merged
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9a5c337
raise IncompleteReadError if only receive partial response
xiangyan99 bb40138
update
xiangyan99 35549b6
Update CHANGELOG.md
xiangyan99 729a873
update
xiangyan99 8db8d69
Merge branch 'core_force_length_check' of https://github.com/Azure/az…
xiangyan99 36f3fd5
get main
xiangyan99 6237902
update
xiangyan99 5db1dd7
update
xiangyan99 89e8734
update
xiangyan99 68259d2
update
xiangyan99 92fd43b
update
xiangyan99 8dfca0d
update
xiangyan99 3da4453
Merge branch 'main' into core_force_length_check
xiangyan99 aeab272
Merge branch 'main' into core_force_length_check
xiangyan99 be24a3a
address review feedback
xiangyan99 82335e5
update
xiangyan99 3c3963a
update
xiangyan99 8d17524
Merge branch 'main' into core_force_length_check
xiangyan99 416253c
Merge branch 'main' into core_force_length_check
xiangyan99 6e37282
Merge branch 'main' into core_force_length_check
xiangyan99 5346036
update
xiangyan99 bb4638d
update
xiangyan99 59f0b34
Update exceptions.py
xiangyan99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
sdk/core/azure-core/tests/async_tests/test_content_length_checking_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# coding: utf-8 | ||
# ------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See LICENSE.txt in the project root for | ||
# license information. | ||
# ------------------------------------------------------------------------- | ||
from azure.core.pipeline import AsyncPipeline | ||
from azure.core.pipeline.transport import ( | ||
HttpRequest, | ||
) | ||
from azure.core import AsyncPipelineClient | ||
from azure.core.exceptions import IncompleteReadError | ||
import pytest | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_aio_transport_short_read_download_stream(port): | ||
url = "http://localhost:{}/errors/short-data".format(port) | ||
client = AsyncPipelineClient(url) | ||
with pytest.raises(IncompleteReadError): | ||
async with client: | ||
request = HttpRequest("GET", url) | ||
pipeline_response = await client._pipeline.run(request, stream=True) | ||
response = pipeline_response.http_response | ||
data = response.stream_download(client._pipeline) | ||
content = b"" | ||
async for d in data: | ||
content += d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# coding: utf-8 | ||
# ------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See LICENSE.txt in the project root for | ||
# license information. | ||
# ------------------------------------------------------------------------- | ||
from azure.core import PipelineClient | ||
from azure.core.pipeline import Pipeline | ||
from azure.core.pipeline.transport import ( | ||
HttpRequest, | ||
RequestsTransport, | ||
) | ||
from azure.core.exceptions import IncompleteReadError | ||
import pytest | ||
|
||
|
||
def test_sync_transport_short_read_download_stream(port): | ||
url = "http://localhost:{}/errors/short-data".format(port) | ||
client = PipelineClient(url) | ||
request = HttpRequest("GET", url) | ||
with pytest.raises(IncompleteReadError): | ||
pipeline_response = client._pipeline.run(request, stream=True) | ||
response = pipeline_response.http_response | ||
data = response.stream_download(client._pipeline) | ||
content = b"" | ||
for d in data: | ||
content += d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could rephrase as '...if peer closes the connection before we have received the complete message body.'
When I see 'sending', I think 'outgoing data'.