Search code examples
scalamime-typesfunctional-testingboundary

MIME processing errors types to treat in a Scala functional test


I have a Scala code with a test for MIME error for 'multipart/form-data' for no bundary. Can you please tell me other MIME processing errors types to treat?

val boundary = "v4cGfsdgdsgdfsh49Sd"
"error if a multipart message posted with no boundary in the MIME type" in new Scope {
      val contentType = `multipart/form-data`.withBoundary(boundary)

      val innerBoundary = "iIbuIgjhgjGJHGjhgjYkn5OK1"
      val contentTypeStringWithoutBoundary =
        s"application/vnd.wap.multipart.mixed; someParam=someValue; " +
          s"otherParam=otherValueObjects"
      val uri = makeObjectsPostUrl
      val entity = HttpEntity(
        contentType,
        ByteString(textMultipartRequestWithType(
          contentTypeStringWithoutBoundary, boundary, innerBoundary)))

      val postRequest = Post(
        uri, entity)
        .withAuth

      val postResponse = makeRequest(postRequest)

      withInfoOnFailure(postResponse) {
        assertResponseIsOmaError(
          postResponse,
          StatusCodes.BadRequest,
          OmaErrors.ServiceErrorWithDescription(
            "Content-Type with a multipart media type must have a " +
              "'boundary' parameter", "0"))
      }
    }

Solution

  • Ok, I've found them all here: https://www.ibm.com/support/knowledgecenter/SS9H2Y_7.6.0/com.ibm.dp.doc/results.html