May 2018
Beginner to intermediate
290 pages
6h 43m
English
You can find a great example of clojure.spec in action in the ring-spec,[27] which contains specs for the Ring web application library. For example, as we saw back in Chapter 6, Functional Things, a key part of a Ring application is dealing with requests, which arrive at the application in the form of maps. But what, exactly, do those request maps contain?
I’m glad you asked:
| | (s/def :ring/request |
| | (s/keys :req-un [:ring.request/server-port |
| | :ring.request/server-name |
| | :ring.request/remote-addr |
| | :ring.request/uri |
| | :ring.request/scheme |
| | :ring.request/protocol |
| | :ring.request/headers |
| | :ring.request/request-method] |
| | :opt-un [:ring.request/query-string |
| | :ring.request/body])) |
Looks like we have a map with entries for port, a ...
Read now
Unlock full access