We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
你可以使用wrap-content-type中间件来在URI中添加一个基于文件扩展的Content-Type的header:
wrap-content-type
Content-Type
(use 'ring.middleware.content-type) (def app (wrap-content-type your-handler))
所以如果一个用户访问一个样式表:
http://example.com/style/screen.css
然后content-type中间件将会添加下面的header:
Content-Type: text/css
你可以看一下默认content type mappings在ring-core/src/ring/util/mime_types.clj.
你也可以添加自定义mime-types通过使用:mime-types选项:
:mime-types
(use 'ring.middleware.content-type) (def app (wrap-content-type your-handler {:mime-types {"foo" "text/x-foo"}}))