-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Feature/multipart headers #2152
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
Conversation
kwach
commented
Jun 6, 2025
- feature: additional field: header - providing access to headers per form-data part
- UT test provided
Adds a `headers` field to the `MultipartFormData` struct. Populates this field by parsing headers from the multipart form data. This allows access to specific headers associated with each form data part.
Verifies the correct retrieval of headers from multipart form data file parts. Ensures that custom and content-related headers are accessible and parsed as expected.
Uses `gtest_discover_tests` to automatically find and run tests, simplifying test maintenance and improving discoverability.
Improves header parsing by using a dedicated parsing function, resulting in cleaner and more robust code. This change also adds error handling during header parsing, returning an error and marking the request as invalid if parsing fails.
@kwach could you please run clang-format? (You don't have to worry about the 'abidiff/abi' error. |
cdd6f30
to
8b70d51
Compare
heh, ok. I've enabled workflows on my fork and now it passes. I'm just learnig about workflows, sorry :D |
ASSERT_EQ("CustomValue", customHeader->second); | ||
ASSERT_TRUE(headers.find("X-Test") == headers.end()); // text1 header | ||
|
||
handled = true; |
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.
Could you explain why handled
is needed?
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 reused code from the MultipartFormDataTest
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.
then there is
ASSERT_TRUE(handled);
in
auto se = detail::scope_exit([&] {...}
Renames the `customHeader` variable to `custom_header` for improved code readability and consistency.
|
Thanks for your fine contribution! |