(name string, data []byte)
| 222 | } |
| 223 | |
| 224 | func refineTextMediaType(name string, data []byte) string { |
| 225 | switch strings.ToLower(filepath.Ext(name)) { |
| 226 | case ".json": |
| 227 | if json.Valid(data) { |
| 228 | return "application/json" |
| 229 | } |
| 230 | case ".md", ".markdown": |
| 231 | return "text/markdown" |
| 232 | case ".csv": |
| 233 | return "text/csv" |
| 234 | } |
| 235 | return "text/plain" |
| 236 | } |
| 237 | |
| 238 | func truncateUTF8Bytes(value string, maxBytes int) string { |
| 239 | if maxBytes <= 0 || value == "" { |
no test coverage detected