Skip to content

Commit

Permalink
Merge pull request #326 from digitallyinduced/benchmark-fixes
Browse files Browse the repository at this point in the history
Added toJSON instance for ID' and added charset to Content-Type
  • Loading branch information
mpscholten authored Aug 12, 2020
2 parents 24c63a1 + e53d674 commit df79e55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion IHP/Controller/Render.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ renderPlain text = respondAndExit $ responseLBS status200 [(hContentType, "text/

{-# INLINE respondHtml #-}
respondHtml :: (?requestContext :: RequestContext) => Html -> IO ()
respondHtml html = respondAndExit $ responseBuilder status200 [(hContentType, "text/html"), (hConnection, "keep-alive")] (Blaze.renderHtmlBuilder html)
respondHtml html = respondAndExit $ responseBuilder status200 [(hContentType, "text/html; charset=utf-8"), (hConnection, "keep-alive")] (Blaze.renderHtmlBuilder html)

{-# INLINE respondSvg #-}
respondSvg :: (?requestContext :: RequestContext) => Html -> IO ()
Expand Down
4 changes: 4 additions & 0 deletions IHP/ModelSupport.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import qualified Control.Newtype.Generics as Newtype
import Control.Applicative (Const)
import qualified GHC.Types as Type
import qualified Data.Text as Text
import Data.Aeson (ToJSON (..))

data ModelContext = ModelContext { databaseConnection :: Connection }

Expand Down Expand Up @@ -425,3 +426,6 @@ fieldWithUpdate name model
| cs (symbolVal name) `elem` get #touchedFields (get #meta model) =
Update (get name model)
| otherwise = NoUpdate name

instance (ToJSON (PrimaryKey a)) => ToJSON (Id' a) where
toJSON (Id a) = toJSON a

0 comments on commit df79e55

Please sign in to comment.