Skip to content

Add multipart/form-data HTTP content factory#7769

Open
Adham-Kiwan wants to merge 1 commit into
elsa-workflows:mainfrom
Adham-Kiwan:feat/multipart-form-data-content-writer
Open

Add multipart/form-data HTTP content factory#7769
Adham-Kiwan wants to merge 1 commit into
elsa-workflows:mainfrom
Adham-Kiwan:feat/multipart-form-data-content-writer

Conversation

@Adham-Kiwan

Copy link
Copy Markdown

Description

Elsa.Http ships IHttpContentFactory implementations for JSON, XML, text and application/x-www-form-urlencoded, but there was no writer for multipart/form-data. This adds MultipartFormDataHttpContentFactory, following the same pattern as the existing FormUrlEncodedHttpContentFactory.

Closes #75. The application/x-www-form-urlencoded half of that issue already exists via FormUrlEncodedHttpContentFactory; this completes the remaining multipart/form-data writer.

Changes

  • Add MultipartFormDataHttpContentFactory in Elsa.Http/ContentWriters, converting dictionary / JsonObject / object content into a MultipartFormDataContent with one text part per field.
  • Register it in both Features/HttpFeature.cs and ShellFeatures/HttpFeature.cs, so multipart/form-data automatically appears in the SendHttpRequest activity's content-type dropdown.
  • Add unit tests in ContentFactoryTests covering the supported content type, boundary generation, per-field parts, and JsonObject payloads.

Testing

dotnet test for Elsa.Http.UnitTests (ContentFactoryTests) — all passing (9/9).

Elsa.Http provided IHttpContentFactory implementations for JSON, XML,
text and application/x-www-form-urlencoded, but there was no writer for
multipart/form-data. Add MultipartFormDataHttpContentFactory following
the same pattern as FormUrlEncodedHttpContentFactory, register it in the
Features and ShellFeatures HttpFeature so it surfaces in the content-type
dropdown, and cover it with unit tests.

Signed-off-by: Adham Kiwan <adhamkiwan@outlook.com>
@greptile-apps

greptile-apps Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@Adham-Kiwan

Copy link
Copy Markdown
Author

@dotnet-policy-service agree

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.

Add content formatter for application/x-www-form-urlencoded and multipart/form-data

1 participant