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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Internal URLRequest Validation API #2905

Merged
merged 2 commits into from Aug 14, 2019

Conversation

@jshier
Copy link
Contributor

commented Aug 13, 2019

Issue Link 馃敆

Similar to fix offered in #2887.

Goals 鈿斤笍

This PR adds API to our internal URLRequest processing that will throw an error when attempting to make a GET request that has body data. This is both to fix existing issues with this behavior, as URLSession doesn't automatically add Content-Length in this case, breaking servers and middleboxes, but it has also become a URLSession error in the 2019 OSes.

Implementation Details 馃毀

This PR adds a validate() method to our internal URLRequest extensions (so this validation is not extensible by users, they can do that as part of URLRequestConvertible), as well as a new AFError case and Reason type. validate() is called after initial URLRequest creation and after adaptation.

Testing Details 馃攳

Tests have been added for both initial and adapted request cases.

@jshier jshier added this to the 5.0.0.rc.1 milestone Aug 13, 2019

@jshier jshier requested a review from cnoon Aug 13, 2019

@jshier jshier changed the title Add URLRequest Validation API Add Internal URLRequest Validation API Aug 13, 2019

@cnoon
cnoon approved these changes Aug 14, 2019
Copy link
Member

left a comment

Looks good to me @jshier! 馃憤

@jshier jshier force-pushed the feature/request-validation branch from a777d9c to 2a60555 Aug 14, 2019

@jshier jshier merged commit e03912e into master Aug 14, 2019

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@jshier jshier deleted the feature/request-validation branch Aug 14, 2019

toomasr added a commit to toomasr/Alamofire that referenced this pull request Aug 19, 2019
Add Internal URLRequest Validation API (Alamofire#2905)
* Add URLRequest validation, error, and tests.

* Clean up whitespace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can鈥檛 perform that action at this time.