1
1
mirror of https://github.com/aelve/guide.git synced 2024-12-25 22:02:58 +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 -- Text
import Data.Text (Text) import Data.Text (Text)
import qualified Data.Text as T import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import qualified Data.Text.IO as T import qualified Data.Text.IO as T
import NeatInterpolation import NeatInterpolation
import qualified Data.Text.Buildable as Format import qualified Data.Text.Buildable as Format
@ -800,8 +801,9 @@ addMethods = Spock.subcomponent "add" $ do
otherMethods :: SpockM () () DB () otherMethods :: SpockM () () DB ()
otherMethods = do otherMethods = do
-- Javascript -- Javascript
Spock.get "js.js" $ Spock.get "js.js" $ do
Spock.text (fromJS allJSFunctions) setHeader "Content-Type" "application/javascript; charset=utf-8"
Spock.bytes $ T.encodeUtf8 (fromJS allJSFunctions)
-- Search -- Search
Spock.post "search" $ do 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: add something to edit a particular paragraph of the notes
-- TODO: serve js.js with MIME “text/javascript” or something
newGroupValue :: Text newGroupValue :: Text
newGroupValue = "-new-group-" newGroupValue = "-new-group-"