ring-clojure / ring

Clojure HTTP server abstraction
MIT License
3.77k stars 520 forks source link

wrap-resource can return a nil to the jetty adapter #385

Closed fiddlerwoaroof closed 4 years ago

fiddlerwoaroof commented 4 years ago

resource-request is specified as returning nil*, which leads to an error if the result of wrap-resource is passed directly to ring. Should line 36 here be something like this instead?

 (if (= 404 (:status response)) 
   (or (resource-request request root-path options)
       response)
   response)))

https://github.com/ring-clojure/ring/blob/7a87a3f8d52285e144d51c0d18602c5294f08a9d/ring-core/src/ring/middleware/resource.clj#L35-L37

* here's the docstring: https://github.com/ring-clojure/ring/blob/7a87a3f8d52285e144d51c0d18602c5294f08a9d/ring-core/src/ring/middleware/resource.clj#L10-L11