Mulesoft provide functions for creating MultiPart and formats and parts (including fields and boundaries) of MultiPart formats.
Below header needs to be added while using dataweave scripts to create multipart messages.
%dw 2.0
import dw::module::Multipart
output multipart/form-data
You will find a github link for sample project at the end of this article.
Now let us understand how we can parse and validate Multipart messages using Munit.
Multipart message formats doesn’t provide flexibility for normal traversing to validate the transformation or output. To validate multipart message we need to transform the message with “application/java” format as highlighted below.
%dw 2.0 output application/java input payload multipart/form-data — payload.parts
Validate size with function sizeOf():
Validate content:
https://github.com/manishkumarsah/multipart-munit-validation-mule4
Happy Learning 🙂
Hello! I could have sworn I’ve been to this site before but after checking through some of the post I realized it’s new to me. Nonetheless, I’m definitely glad I found it and I’ll be book-marking and checking back often!