The request or target URL the media type is to be retrieved from
The extra media types, keyed by lowercase extension, taking precedence over the default ones
The media type of the extension of the file the target names, or the wildcard media range if the target
names no file, or a file whose extension is missing or listed neither by types nor by the defaults
TypeError If input states a target that is not an absolute URI
Retrieves the media type of the target of a request.
The media type is identified the way a static server identifies it, by the extension of the file the target names. Extensions are matched case-insensitively, and the query and the fragment are ignored. A path ending in a slash names no file, and a hidden file such as
.profilehas no extension.The default media types cover the textual formats a site commonly serves, YAML included under the type RFC 9512 registers. Media types stated by
typestake precedence, so a caller may add an extension or remap a known one.A target with no known extension is assigned the wildcard media range, which matches any media type. The returned type is therefore always a valid media range, ready to be stated as is in the
Acceptheader of a request.