Skip to content

Commit

Permalink
Forenkle/Fix validatemimeheaders
Browse files Browse the repository at this point in the history
  • Loading branch information
RettIProd committed Oct 25, 2023
1 parent 2fbb416 commit d63c3d4
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ fun PartData.validateMimeAttachment() {
}

// KRAV 5.5.2.1 validate MIME
private fun Headers.validateMimeHeaders() {
takeUnless { (this[MimeHeaders.MIME_VERSION].isNullOrBlank()).or(this[MimeHeaders.MIME_VERSION] != "1.0") }
?: throw MimeValidationException("MIME version is missing or incorrect")
takeUnless { this[MimeHeaders.SOAP_ACTION].isNullOrBlank().or(this[MimeHeaders.SOAP_ACTION] != "ebXML") }
?: throw MimeValidationException("SOAPAction is undefined or incorrect")
takeUnless { this[MimeHeaders.CONTENT_TYPE].isNullOrBlank().or(this[MimeHeaders.CONTENT_TYPE] == "text/plain") }
?: throw MimeValidationException("Content type is wrong")
fun Headers.validateMimeHeaders() {
if(this[MimeHeaders.MIME_VERSION] != "1.0")
throw MimeValidationException("MIME version is missing or incorrect")
if(this[MimeHeaders.SOAP_ACTION] != "ebXML")
throw MimeValidationException("SOAPAction is undefined or incorrect")
if(this[MimeHeaders.CONTENT_TYPE].isNullOrBlank() || this[MimeHeaders.CONTENT_TYPE] == "text/plain")
throw MimeValidationException("Content type is wrong")
}


Expand Down

0 comments on commit d63c3d4

Please sign in to comment.