Class RecordedRequest.Part

java.lang.Object
com.shri.restinpeace.mock.RecordedRequest.Part
Enclosing class:
RecordedRequest

public static final class RecordedRequest.Part extends Object
One part of a decoded multipart/form-data request body, as returned by RecordedRequest.getParts().
  • Method Details

    • getName

      public String getName()
      Returns this part's name - the @Part's value, or the entry's key for a @PartMap part.
      Returns:
      the part name
    • getFileName

      public String getFileName()
      Returns this part's file name, for a File/byte[]/ InputStream part sent as a file.
      Returns:
      the file name, or null for a plain String form field
    • getContentType

      public String getContentType()
      Returns this part's Content-Type, if one was sent.
      Returns:
      the content type, or null if none was sent
    • getContent

      public byte[] getContent()
      Returns this part's raw content bytes.
      Returns:
      the content bytes
    • getContentAsString

      public String getContentAsString()
      Returns this part's content decoded as UTF-8, for a text part (a plain String form field, or a text file).
      Returns:
      the content as a UTF-8 string