Skip to content

Fix: trim whitespace around the Content-Type parameter separator - #49

Merged
Garados007 merged 1 commit into
Garados007:mainfrom
S0CloseYetS0Far:fix/post-mime-whitespace
Oct 4, 2026
Merged

Garados007 merged 1 commit into
Garados007:mainfrom
S0CloseYetS0Far:fix/post-mime-whitespace

Conversation

@S0CloseYetS0Far

Copy link
Copy Markdown
Contributor

Fixes #36

Content-Type: multipart/form-data ; boundary=x (optional whitespace before ; is allowed by RFC 9110) left MimeType as "multipart/form-data ". The DataHandler lookup missed, so the body was stored as RawPostData instead of being parsed.

Change: HttpPost.SetPost now trims the media type and the parameter part after splitting on ;.

Tests (TestHttpPost):

  • a urlencoded Content-Type with ; charset=utf-8 resolves to UrlEncodedData and a trimmed MimeType
  • a multipart body with multipart/form-data ; boundary=x is parsed into its entries

Both fail on main and pass with the fix. Full suite passes on net8.0 and net10.0.

🤖 Generated with Claude Code

RFC 9110 allows optional whitespace before the `;`, so a header such as
`multipart/form-data ; boundary=x` left a trailing space in the media type.
The DataHandler lookup then missed and the body was stored as RawPostData
instead of being parsed.

Fixes Garados007#36

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@S0CloseYetS0Far

Copy link
Copy Markdown
Contributor Author

:)

@Garados007

Copy link
Copy Markdown
Owner

LGTM

@Garados007
Garados007 merged commit 764df99 into Garados007:main Oct 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Content-Type media type is not trimmed before handler lookup

2 participants