codejump
EasyPro challengePythonJavaScriptTypeScript

MIME Type Lookup

BackendHTTPFiles

Given a file path, return the MIME type based on extension.

Supported:

  • .html → 'text/html'
  • .css → 'text/css'
  • .js → 'application/javascript'
  • .json → 'application/json'
  • .png → 'image/png'
  • .jpg, .jpeg → 'image/jpeg'
  • Unknown / no ext → 'application/octet-stream'

Match is case-insensitive on the extension.

Sample tests

Test #1HTML file
Input: ["index.html"]
Output: "text/html"
Test #2Uppercase ext
Input: ["photo.JPG"]
Output: "image/jpeg"
Test #3JSON
Input: ["data.json"]
Output: "application/json"
Test #4No extension
Input: ["README"]
Output: "application/octet-stream"
Test #5Unknown extension
Input: ["archive.tar.gz"]
Output: "application/octet-stream"