Repository navigation
Raise a specific error for missing boundaries - #399
Closed
ryanduguid wants to merge 1 commit into
Closed
ryanduguid wants to merge 1 commit into
ryanduguid wants to merge 1 commit into
Conversation
Multipart responses without a recognised boundary currently fail with a broad AttributeError during body parsing. Give callers a dedicated exception from both decoder entry points and expose it through the existing public import layers. Document the error change and cover valid parsing, error precedence, empty and duplicate boundaries, encoding and exports. Closes #303
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Raise
MissingBoundaryExceptionwhenMultipartDecoderorfrom_responsereceives a multipart Content-Type without a recognised boundary, before body parsing. Export the exception through the existing public import layers and document it.Closes #303.
Evidence
AttributeErrorfailures and 43 passing controls.After: All 49 decoder tests pass on Python 2.7.18, 3.7.17, Windows 3.12.10 and the installed Linux 3.12.15 wheel. Coverage includes both construction routes, error precedence, empty and duplicate boundaries, quoted parameters, encoding and public exports.
py27-flake8andpy37-flake8Tox environments pass.tox -e docs, the CI package builds and strict Twine checks pass on baseline and candidate. The rendered decoder page and installed wheel were inspected.Risk
Callers catching
AttributeErrorfor a missing boundary must catchMissingBoundaryException. Recognised empty boundaries and the last recognised duplicate retain the existing parser behaviour, covered by regression controls.Unverified
Full Tox fails with the same failures on master and this branch: Python 2.7 stops on the
datetime.timezoneimport, Python 3.7 and 3.9 have two X509 deprecation failures, and Python 3.12 has 25 Betamaxdatetime.utcnowfailures plus the two X509 failures. The full Windows suite, macOS, PyPy,noopenssland upstream CI were not run.