Fork me on GitHub
#beginners
<
2019-02-10
>
_rj_r_04:02:41

does anyone know why Jetty would be serving a css page as text/plain? Or maybe something I am doing wrong in Hiccup? I am getting the following message in the browser:

Resource interpreted as Stylesheet but transferred with MIME type text/plain

seancorfield07:02:41

@ryan.russell011 how do you have your app configured to serve resources (files)?

joshkh15:02:54

how might i go about writing a Clojure spec that restricts a map to only contain keys that are a subset of a superset of keys? for example, given valid keys #{:test/a :test/b :test/c :test/d}, map {:test/a nil :test/c nil} is valid.

joshkh15:02:57

hmm. looks like disallowing keys is not the right paradigm after all. https://stackoverflow.com/questions/38131252/forbidden-keys-in-clojure-spec

joshkh15:02:09

anywho i solved it with s/map-of:

(s/conform (s/map-of #{:test/a :test/b} string?) {:test/a "test" :test/b "test" :test/c "test"})
=> :clojure.spec.alpha/invalid
🙂

seancorfield20:02:21

As you already discovered, that's not idiomatic. Clojure is mean to be open for extension -- and closed key maps run counter to that.

joshkh01:02:53

my true intention was to help focus the results of generating test data

joshkh01:02:17

fmap to the rescue. thanks for your input by the way.