2

我有一个返回文件的组合路由。我想测试 -

1) 如果返回文件。2) 返回的特定文件。

当我跑步时,(app (ring.mock/request :get "/myroute"))我得到

{:body #<File resources/public/templates/index.html>, :headers {"Content-Length" "2349", "Last-Modified" "Sat, 16 Mar 2013 11:01:03 GMT"}, :status 200}

如何检查正文中的返回值是否属于文件类型?并且变得更加雄心勃勃,我可以检查它是位于 'resources/public/templates/index.html' 的文件吗?

4

1 回答 1

1

环请求只是映射,因此您可以使用 :body 关键字提取正文,然后检查它的类型type

(type (:body (app (ring.mock/request :get "/myroute"))))

(也许我不理解这个问题?)

于 2013-03-19T18:10:26.023 回答