tmimetypes.nim 466 B

123456789101112131415161718192021
  1. discard """
  2. matrix: "--mm:refc; --mm:orc"
  3. targets: "c js"
  4. """
  5. import std/mimetypes
  6. import std/assertions
  7. template main() =
  8. var m = newMimetypes()
  9. doAssert m.getMimetype("mp4") == "video/mp4"
  10. doAssert m.getExt("application/json") == "json"
  11. m.register("foo", "baa")
  12. doAssert m.getMimetype("foo") == "baa"
  13. # see also `runnableExamples`.
  14. # xxx we should have a way to avoid duplicating code between runnableExamples and tests
  15. static: main()
  16. main()