Skip to content

Commit

Permalink
Merge pull request #1137 from anto-ac/fix-contenttype-supertype-resol…
Browse files Browse the repository at this point in the history
…ution-octet-stream

fix: content-type super-type resolution for application/octet-stream …
  • Loading branch information
Ronald Holshausen committed Jun 19, 2020
2 parents 9ec845a + 7d9eab3 commit 152ecc1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Expand Up @@ -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}")
Expand Down
Expand Up @@ -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)
}
Expand Down

0 comments on commit 152ecc1

Please sign in to comment.