1
1
mirror of https://github.com/aelve/guide.git synced 2024-12-25 13:51:45 +03:00

Serve js.js with correct MIME type

This commit is contained in:
Artyom 2016-03-11 15:02:53 +03:00
parent e8c94ced39
commit cd26bfcfe8

View File

@ -31,6 +31,7 @@ import Data.Map (Map)
-- Text
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import qualified Data.Text.IO as T
import NeatInterpolation
import qualified Data.Text.Buildable as Format
@ -800,8 +801,9 @@ addMethods = Spock.subcomponent "add" $ do
otherMethods :: SpockM () () DB ()
otherMethods = do
-- Javascript
Spock.get "js.js" $
Spock.text (fromJS allJSFunctions)
Spock.get "js.js" $ do
setHeader "Content-Type" "application/javascript; charset=utf-8"
Spock.bytes $ T.encodeUtf8 (fromJS allJSFunctions)
-- Search
Spock.post "search" $ do
@ -1530,7 +1532,5 @@ sectionSpan t attrs = span_ (class_ (t <> " section ") : attrs)
-- TODO: add something to edit a particular paragraph of the notes
-- TODO: serve js.js with MIME “text/javascript” or something
newGroupValue :: Text
newGroupValue = "-new-group-"