Add support for multipart/mixed content type#1291
Conversation
This commit adds comprehensive support for multipart/mixed content,
commonly used for batch API requests (e.g., SharePoint, GraphQL).
Core functionality:
- Added `type` field to Form struct to support :formdata and :mixed
- Form constructor accepts type parameter (defaults to :formdata)
- Form(Vector{Multipart}) constructor for multipart/mixed
- Updated content_type() to return correct MIME type based on form type
Parsing enhancements:
- Modified parsing to optionally skip Content-Disposition headers
(not required for multipart/mixed per RFC2046)
- Added parse_multipart() as generic parser for any multipart type
- Added parse_multipart_mixed() convenience function
- Support for type filtering in parsing functions
API additions:
- Batch() convenience function for semantic batch request creation
- Exported: parse_multipart, parse_multipart_mixed, Batch
Testing:
- Comprehensive test suite in test/http_multipart_mixed.jl
- 41 tests covering creation, parsing, round-trip, and edge cases
The implementation is adapted from the original work in commit
573fb62 but updated to work with
HTTP v2 architecture where multipart functionality is consolidated
in http_forms.jl.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1291 +/- ##
==========================================
+ Coverage 84.60% 87.33% +2.73%
==========================================
Files 28 29 +1
Lines 10787 11356 +569
==========================================
+ Hits 9126 9918 +792
+ Misses 1661 1438 -223 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@quinnj Just found some possible improvements, please don't merge yet |
|
@quinnj just review as is! The idea I had was not so good... |
|
@quinnj just need feedback on my two open conversations. |
|
Don't merge yet, I'm still adding an example ... |
Extends parse_multipart_form(), parse_multipart(), and parse_multipart_mixed()
to accept Union{Request,Response}, enabling parsing of multipart responses from
external APIs (e.g., SharePoint batch operations, GraphQL batch queries).
Changes:
- Refactor to use Union{Request,Response} pattern (matches http_core.jl style)
- Unify body extraction into _message_body_bytes() helper
- Add comprehensive test coverage for Response parsing
- Include batch server example demonstrating multipart/mixed usage
- Update docstrings with jldoctest examples
- Fully backward compatible with existing Request API
All tests pass.
|
I've added a multibatch example including server. It turned out that the parsing was needed for both Requests and Responses, so I decided to unify http_forms.jl accordingly. Here's what I did in detail
This is all fully backward compatible with existing Request API |
|
@quinnj ready for final review :-) |
|
Found a bug in HTTP 2.3.0, it references VERSION in HTTP's scope for the public declarations. I fixed it here and also filed #1313 |
This PR is a port of the older #1100 with the help of Claude 4.5
It fixes #1101.
This commit adds comprehensive support for multipart/mixed content, commonly used for batch API requests (e.g., SharePoint, GraphQL).
Core functionality:
typefield to Form struct to support :formdata and :mixedParsing enhancements:
API additions:
Testing:
The implementation is adapted from the original work in commit 573fb62 but updated to work with HTTP v2 architecture where multipart functionality is consolidated in http_forms.jl.