()
| 305 | } |
| 306 | |
| 307 | func (s *Spec) GetContentType() string { |
| 308 | if s.ContentType != "" { |
| 309 | return s.ContentType |
| 310 | } |
| 311 | switch { |
| 312 | case s.Compression == filetypes.CompressionTypeGZip: |
| 313 | // https://www.iana.org/assignments/media-types/application/gzip |
| 314 | return "application/gzip" |
| 315 | case s.Compression != "": |
| 316 | // https://www.iana.org/assignments/media-types/application/octet-stream |
| 317 | return "application/octet-stream" |
| 318 | } |
| 319 | |
| 320 | switch s.Format { |
| 321 | case "json": |
| 322 | // https://www.iana.org/assignments/media-types/application/json |
| 323 | return "application/json" |
| 324 | case "csv": |
| 325 | // https://www.iana.org/assignments/media-types/text/csv |
| 326 | return "text/csv" |
| 327 | case "parquet": |
| 328 | // https://www.iana.org/assignments/media-types/application/vnd.apache.parquet |
| 329 | return "application/vnd.apache.parquet" |
| 330 | } |
| 331 | // This is the default content type for all unknown files |
| 332 | return "application/octet-stream" |
| 333 | } |
no outgoing calls