Skip to content

Commit

Permalink
Merge pull request #65 from shogo82148/yaml-is-not-binary
Browse files Browse the repository at this point in the history
Add support for YAML media type in isBinary function
  • Loading branch information
shogo82148 authored Feb 5, 2024
2 parents 5c90f74 + 2da4203 commit 60457f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions ridgenative.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,9 @@ func isBinary(contentType string) bool {
if strings.EqualFold(mediaType, "application/json") {
return false
}
if strings.EqualFold(mediaType, "application/yaml") {
return false
}
if strings.EqualFold(mediaType, "application/javascript") {
return false
}
Expand All @@ -393,6 +396,9 @@ func isBinary(contentType string) bool {
if strings.EqualFold(suffix, "+json") {
return false
}
if strings.EqualFold(suffix, "+yaml") {
return false
}
if strings.EqualFold(suffix, "+xml") {
return false
}
Expand Down
8 changes: 5 additions & 3 deletions ridgenative_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -960,10 +960,12 @@ func TestIsBinary(t *testing.T) {
{"text/xml", false},
{"application/json", false},
{"application/javascript", false},
{"application/yaml", false},
{"application/xml", false},
{"application/foo+json", false},
{"application/foo+xml", false},
{"application/foo+xml ; charset=utf8", false},
{"application/vnd.foo+json", false},
{"application/vnd.foo+yaml", false},
{"application/vnd.foo+xml", false},
{"application/vnd.foo+xml ; charset=utf8", false},
{"application/octet-stream", true},
{"image/jpeg", true},
{"audio/mpeg", true},
Expand Down

0 comments on commit 60457f1

Please sign in to comment.