-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
[MRG+1] Fix form methods in FormRequest.from_response (#3777) #3794
[MRG+1] Fix form methods in FormRequest.from_response (#3777) #3794
Conversation
scrapy/http/request/form.py
Outdated
|
||
method = kwargs.pop('method', form.method).upper() | ||
if method not in cls.valid_form_methods: | ||
raise ValueError('Invalid form method in chosen form') |
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.
I wonder if we should follow standard more closely, and consider unknown and invalid methods as GET (see https://www.w3.org/TR/html5/sec-forms.html#element-attrdef-form-method):
The invalid value default for these attributes is the GET state. The missing value default for the method attribute is also the GET state. (There is no missing value default for the formmethod attribute.)
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.
Yep, I agree with that, I'm going to modify the PR.
Codecov Report
@@ Coverage Diff @@
## master #3794 +/- ##
==========================================
+ Coverage 85.42% 85.43% +<.01%
==========================================
Files 169 169
Lines 9635 9638 +3
Branches 1433 1434 +1
==========================================
+ Hits 8231 8234 +3
Misses 1156 1156
Partials 248 248
|
Codecov Report
@@ Coverage Diff @@
## master #3794 +/- ##
=========================================
- Coverage 85.42% 85.4% -0.03%
=========================================
Files 169 169
Lines 9635 9687 +52
Branches 1433 1445 +12
=========================================
+ Hits 8231 8273 +42
- Misses 1156 1166 +10
Partials 248 248
|
Updated with Mikhail's feedback |
Thanks @csalazar! |
Fixes #3777