在 Scala 功能测试中处理的 MIME 处理错误类型
MIME processing errors types to treat in a Scala functional test
我有一个 Scala 代码,用于测试 'multipart/form-data' 的 MIME 错误,没有边界。你能告诉我其他要处理的 MIME 处理错误类型吗?
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"))
}
}
我有一个 Scala 代码,用于测试 'multipart/form-data' 的 MIME 错误,没有边界。你能告诉我其他要处理的 MIME 处理错误类型吗?
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"))
}
}