tmimetypes.nim 434 B

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