diff --git a/core/model/src/main/kotlin/au/com/dius/pact/core/model/ContentType.kt b/core/model/src/main/kotlin/au/com/dius/pact/core/model/ContentType.kt index b5af1903e1..ec26829bf6 100644 --- a/core/model/src/main/kotlin/au/com/dius/pact/core/model/ContentType.kt +++ b/core/model/src/main/kotlin/au/com/dius/pact/core/model/ContentType.kt @@ -48,7 +48,7 @@ class ContentType(val contentType: MediaType?) { fun isBinaryType(): Boolean { return if (contentType != null) { - val superType = registry.getSupertype(contentType) + val superType = registry.getSupertype(contentType) ?: MediaType.OCTET_STREAM val type = contentType.type val baseType = superType.type val override = System.getProperty("pact.content_type.override.$type.${contentType.subtype}") diff --git a/core/model/src/test/groovy/au/com/dius/pact/core/model/ContentTypeSpec.groovy b/core/model/src/test/groovy/au/com/dius/pact/core/model/ContentTypeSpec.groovy index ba0d3dc66a..73f382b3d6 100644 --- a/core/model/src/test/groovy/au/com/dius/pact/core/model/ContentTypeSpec.groovy +++ b/core/model/src/test/groovy/au/com/dius/pact/core/model/ContentTypeSpec.groovy @@ -67,21 +67,22 @@ class ContentTypeSpec extends Specification { where: - value || result - '' || false - 'text/plain' || false - 'application/pdf' || true - 'application/zip' || true - 'application/json' || false - 'application/hal+json' || false - 'application/HAL+JSON' || false - 'application/xml' || false - 'application/atom+xml' || false - 'image/jpeg' || true - 'video/H264' || true - 'audio/aac' || true - 'text/csv' || false - 'multipart/form-data' || true + value || result + '' || false + 'text/plain' || false + 'application/pdf' || true + 'application/zip' || true + 'application/json' || false + 'application/hal+json' || false + 'application/HAL+JSON' || false + 'application/xml' || false + 'application/atom+xml' || false + 'application/octet-stream' || true + 'image/jpeg' || true + 'video/H264' || true + 'audio/aac' || true + 'text/csv' || false + 'multipart/form-data' || true contentType = new ContentType(value) }