Class MultipartFormDataDecoder

java.lang.Object
org.mockserver.codec.MultipartFormDataDecoder

public class MultipartFormDataDecoder extends Object
Decodes a multipart/form-data request body into field-level Parameters maps that can be matched the same way form parameters are.

Returns three multi-valued maps keyed by part field name:

Parsing uses Netty's HttpPostMultipartRequestDecoder; no additional dependency is introduced.
  • Constructor Details

    • MultipartFormDataDecoder

      public MultipartFormDataDecoder()
  • Method Details

    • decode

      public MultipartFormDataDecoder.DecodedMultipart decode(String contentTypeHeader, byte[] body)
      Decodes the supplied body bytes using the boundary from the supplied Content-Type header value.
      Parameters:
      contentTypeHeader - the full request Content-Type header (must contain a boundary)
      body - the raw request body bytes
      Returns:
      the decoded multipart parts, or null if the body is not multipart/form-data or cannot be parsed