Skip to content

Commit 5466dc3

Browse files
yesod-static: fix test suite with mime-types >= 0.1.2.1 (#1898)
mime-types 0.1.2.1 changed the MIME type of JavaScript files to text/javascript. In most situation, it is unproblematic to also allow the old MIME type (application/javascript), so we don't need to arbitrarily restrict the lower bound on mime-types (this can still be done by users if necessary). Resolves #1897. Co-authored-by: Matt Parsons <parsonsmatt@gmail.com>
1 parent f111e5b commit 5466dc3

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

yesod-static/ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ChangeLog for yesod-static
22

3+
## 1.6.1.2
4+
5+
* Allow JavaScript MIME type used by `mime-types >= 0.1.2.1` in test suite [#1898](https://github.com/yesodweb/yesod/pull/1898)
6+
37
## 1.6.1.1
48

59
* Use crypton instead of cryptonite [#1838](https://github.com/yesodweb/yesod/pull/1838)

yesod-static/test/EmbedProductionTest.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,10 @@ embedProductionSpecs = yesodSpec (MyApp eProduction) $ do
121121
get $ TL.toStrict $ TL.decodeUtf8 src
122122
statusIs 200
123123
hasCacheControl
124-
assertHeader "Content-Type" "application/javascript"
124+
withResponse $ \resp -> liftIO $
125+
assertBool "Content-Type header is application/javascript or text/javascript" $
126+
lookup "Content-Type" (simpleHeaders resp) `elem`
127+
[ Just "text/javascript" -- mime-types >= 0.1.2.1
128+
, Just "application/javascript" -- mime-types <= 0.1.2.0
129+
]
125130
bodyEquals "console.log(\"Hello World\");"

yesod-static/yesod-static.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: yesod-static
2-
version: 1.6.1.1
2+
version: 1.6.1.2
33
license: MIT
44
license-file: LICENSE
55
author: Michael Snoyman <michael@snoyman.com>

0 commit comments

Comments
 (0)