-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Fix FormRequest.formdata with GET method duplicates same key in querystring (#2919) #3269
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3269 +/- ##
==========================================
+ Coverage 82.12% 82.13% +<.01%
==========================================
Files 228 228
Lines 9599 9603 +4
Branches 1385 1386 +1
==========================================
+ Hits 7883 7887 +4
Misses 1457 1457
Partials 259 259
|
d34d640
to
095c727
Compare
scrapy/http/request/form.py
Outdated
self._set_url(self.url + ('&' if '?' in self.url else '?') + querystr) | ||
query = dict(parse_qsl(urlparse(self.url).query)) | ||
if query: | ||
query.update(dict(items)) |
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.
Sometimes we've to send multiple values for a single key, dict(items)
will make it impossible and will result in unexpected URL.
formdata=[ ('a','1'), ('a','2'), ('b','3'), ]
@iamriel Can you add another test case which tests below formdata
|
@HassanQamar07 Thanks for checking this PR, you are right about it, I have updated the implementation and added the test in this commit. Please let me know if there is anything else. Thanks! |
Ooops, the build failed, I'll update later today. |
@iamriel , what happens when there is fragment in url. I think your code fails. |
I apologize I haven't had time to attend into this. I'm closing this as @maramsumanth already had an approved PR for this. Thanks everyone! |
This is the fix for issue #2919 This is my first time contributing to an open source project. This PR is based on gekco's PR here. I followed the instruction in Submitting Patches for updating an existing PR. Hopefully I have done it correctly.