fileExtension(_:)
Creates a MediaType
from a file extension, if possible.
static func fileExtension(_ ext: String) -> HTTPMediaType?
Parameters
- ext
File extension (ie., “txt”, “json”, “html”).
Returns
Newly created MediaType
, nil
if none was found.
guard let mediaType = MediaType.fileExtension("txt") else { ... }