Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media/mediaType.go')
-rw-r--r--media/mediaType.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/media/mediaType.go b/media/mediaType.go
index 942e9070e..6b6f90439 100644
--- a/media/mediaType.go
+++ b/media/mediaType.go
@@ -14,6 +14,7 @@
package media
import (
+ "encoding/json"
"fmt"
"sort"
"strings"
@@ -177,3 +178,16 @@ func DecodeTypes(maps ...map[string]interface{}) (Types, error) {
return m, nil
}
+
+func (t Type) MarshalJSON() ([]byte, error) {
+ type Alias Type
+ return json.Marshal(&struct {
+ Type string
+ String string
+ Alias
+ }{
+ Type: t.Type(),
+ String: t.String(),
+ Alias: (Alias)(t),
+ })
+}