typeByExtension function

Middleware typeByExtension(
  1. String fileExtension, {
  2. String unknownMimeType = 'application/unknown',
})

Sets the content type header of the response to a mime-type that matches the give fileExtension.

Implementation

Middleware typeByExtension(
  String fileExtension, {
  String unknownMimeType = 'application/unknown',
}) =>
    setContentType(mimeFromExtension(fileExtension) ?? unknownMimeType);