From 822dc627a1cfdf1f97882f27761675ac6ace7669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 21 Dec 2018 16:21:13 +0100 Subject: tpl/transform: Add transform.Unmarshal func Fixes #5428 --- media/mediaType.go | 4 ++++ media/mediaType_test.go | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'media') diff --git a/media/mediaType.go b/media/mediaType.go index 9f7673ecc..01a6b9582 100644 --- a/media/mediaType.go +++ b/media/mediaType.go @@ -135,6 +135,8 @@ var ( XMLType = Type{MainType: "application", SubType: "xml", Suffixes: []string{"xml"}, Delimiter: defaultDelimiter} SVGType = Type{MainType: "image", SubType: "svg", mimeSuffix: "xml", Suffixes: []string{"svg"}, Delimiter: defaultDelimiter} TextType = Type{MainType: "text", SubType: "plain", Suffixes: []string{"txt"}, Delimiter: defaultDelimiter} + TOMLType = Type{MainType: "application", SubType: "toml", Suffixes: []string{"toml"}, Delimiter: defaultDelimiter} + YAMLType = Type{MainType: "application", SubType: "yaml", Suffixes: []string{"yaml", "yml"}, Delimiter: defaultDelimiter} OctetType = Type{MainType: "application", SubType: "octet-stream"} ) @@ -154,6 +156,8 @@ var DefaultTypes = Types{ SVGType, TextType, OctetType, + YAMLType, + TOMLType, } func init() { diff --git a/media/mediaType_test.go b/media/mediaType_test.go index bf356582f..ea6499a14 100644 --- a/media/mediaType_test.go +++ b/media/mediaType_test.go @@ -39,6 +39,8 @@ func TestDefaultTypes(t *testing.T) { {SVGType, "image", "svg", "svg", "image/svg+xml", "image/svg+xml"}, {TextType, "text", "plain", "txt", "text/plain", "text/plain"}, {XMLType, "application", "xml", "xml", "application/xml", "application/xml"}, + {TOMLType, "application", "toml", "toml", "application/toml", "application/toml"}, + {YAMLType, "application", "yaml", "yaml", "application/yaml", "application/yaml"}, } { require.Equal(t, test.expectedMainType, test.tp.MainType) require.Equal(t, test.expectedSubType, test.tp.SubType) @@ -50,6 +52,8 @@ func TestDefaultTypes(t *testing.T) { } + require.Equal(t, 15, len(DefaultTypes)) + } func TestGetByType(t *testing.T) { -- cgit v1.2.3