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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multipart/form-data to FormRequest #6332

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alexandresgf
Copy link

@alexandresgf alexandresgf commented May 4, 2024

Fixes #1897, closes #1954

Copy link

codecov bot commented May 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 43.01%. Comparing base (1d11ea3) to head (6b6af57).
Report is 8 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #6332       +/-   ##
===========================================
- Coverage   83.92%   43.01%   -40.92%     
===========================================
  Files         161      161               
  Lines       11972    12010       +38     
  Branches     1865     1931       +66     
===========================================
- Hits        10048     5166     -4882     
- Misses       1588     6421     +4833     
- Partials      336      423       +87     
Files Coverage Δ
scrapy/http/request/form.py 19.40% <ø> (-78.36%) ⬇️

... and 141 files with indirect coverage changes

@wRAR
Copy link
Member

wRAR commented May 4, 2024

Doesn't look like this changes anything except Content-Type, is this correct?

@alexandresgf
Copy link
Author

Doesn't look like this changes anything except Content-Type, is this correct?

Right, as suggested by the OP in the ticket, it should be a flag, in this case is_multipart, which changes the Content-Type to multipart/form-data. I also added a new parameter to FormRequest constructor.

@wRAR
Copy link
Member

wRAR commented May 6, 2024

The format of multipart/form-data requests is very different from the application/x-www-form-urlencoded one, see e.g. https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4 or the previous PR on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support for "multipart/form-data" in scrapy.FormRequest
2 participants