-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent_type.go
More file actions
171 lines (158 loc) · 3.02 KB
/
Copy pathcontent_type.go
File metadata and controls
171 lines (158 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
package web
type ContentType struct {
ApplicationJson any
ApplicationXml any
ApplicationXWWWFormURLEncoded any
ApplicationJavaScript any
ApplicationPdf any
ApplicationZip any
TextHtml any
TextPlain any
TextCss any
TextCsv any
TextJavaScript any
ImageJpeg any
ImagePng any
ImageGif any
ImageSvgXml any
ImageWebp any
AudioMpeg any
AudioOgg any
AudioWav any
VideoMp4 any
VideoMpeg any
VideoOgg any
MultipartFormData any
}
func (c *ContentType) Iterate() func(func(contentType string, value any) bool) {
return func(yield func(contentType string, value any) bool) {
if c.ApplicationJson != nil {
if !yield("application/json", c.ApplicationJson) {
return
}
}
if c.ApplicationXml != nil {
if !yield("application/xml", c.ApplicationXml) {
return
}
}
if c.ApplicationXWWWFormURLEncoded != nil {
if !yield("application/x-www-form-urlencoded", c.ApplicationXWWWFormURLEncoded) {
return
}
}
if c.ApplicationJavaScript != nil {
if !yield("application/javascript", c.ApplicationJavaScript) {
return
}
}
if c.ApplicationPdf != nil {
if !yield("application/pdf", c.ApplicationPdf) {
return
}
}
if c.ApplicationZip != nil {
if !yield("application/zip", c.ApplicationZip) {
return
}
}
if c.TextHtml != nil {
if !yield("text/html", c.TextHtml) {
return
}
}
if c.TextPlain != nil {
if !yield("text/plain", c.TextPlain) {
return
}
}
if c.TextCss != nil {
if !yield("text/css", c.TextCss) {
return
}
}
if c.TextCsv != nil {
if !yield("text/csv", c.TextCsv) {
return
}
}
if c.TextJavaScript != nil {
if !yield("text/javascript", c.TextJavaScript) {
return
}
}
if c.ImageJpeg != nil {
if !yield("image/jpeg", c.ImageJpeg) {
return
}
}
if c.ImagePng != nil {
if !yield("image/png", c.ImagePng) {
return
}
}
if c.ImageGif != nil {
if !yield("image/gif", c.ImageGif) {
return
}
}
if c.ImageSvgXml != nil {
if !yield("image/svg+xml", c.ImageSvgXml) {
return
}
}
if c.ImageWebp != nil {
if !yield("image/webp", c.ImageWebp) {
return
}
}
if c.AudioMpeg != nil {
if !yield("audio/mpeg", c.AudioMpeg) {
return
}
}
if c.AudioOgg != nil {
if !yield("audio/ogg", c.AudioOgg) {
return
}
}
if c.AudioWav != nil {
if !yield("audio/wav", c.AudioWav) {
return
}
}
if c.VideoMp4 != nil {
if !yield("video/mp4", c.VideoMp4) {
return
}
}
if c.VideoMpeg != nil {
if !yield("video/mpeg", c.VideoMpeg) {
return
}
}
if c.VideoOgg != nil {
if !yield("video/ogg", c.VideoOgg) {
return
}
}
if c.MultipartFormData != nil {
if !yield("multipart/form-data", c.MultipartFormData) {
return
}
}
}
}
func isContentType(t any) *ContentType {
if t == nil {
return nil
}
switch c := t.(type) {
case ContentType:
return &c
case *ContentType:
return c
default:
return nil
}
}