Skip to content

Commit

Permalink
fix: content-type super-type resolution for application/octet-stream …
Browse files Browse the repository at this point in the history
…is now correct
  • Loading branch information
e-ivaldi committed Jun 18, 2020
1 parent 512f683 commit 7d9eab3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 7d9eab3

Please sign in to comment.