From d2cbea0f577c30dba41b02310c28f67a63aa74da Mon Sep 17 00:00:00 2001 From: sabadev Date: Sun, 11 Apr 2021 20:21:57 -0400 Subject: [PATCH] Generified image types. --- src/ApiTypes.hs | 2 +- src/ImageContentType.hs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ApiTypes.hs b/src/ApiTypes.hs index 7e54905..61cefa5 100644 --- a/src/ApiTypes.hs +++ b/src/ApiTypes.hs @@ -16,7 +16,7 @@ type Api = Styling :<|> Page type Page = ChangeTheme :<|> ImageLink :<|> MainPage :<|> BlogPost type MainPage = ThemeParam :> Get '[HTML] (Html ()) type BlogPost = ThemeParam :> Capture "id" BlogId :> Get '[HTML] (Html ()) -type ImageLink = "image" :> Capture "id" ImageId :> Get '[PNG] ByteString +type ImageLink = "image" :> Capture "id" ImageId :> Get '[IMG] ByteString type Styling = "style" :> ThemeParam :> Get '[CSS] C.Css type ChangeTheme = ReqBody '[FormUrlEncoded] Theme :> Capture "id" BlogId :> Post '[HTML] (Html ()) type ThemeParam = QueryParam "theme" Theme diff --git a/src/ImageContentType.hs b/src/ImageContentType.hs index e457160..2bc456b 100644 --- a/src/ImageContentType.hs +++ b/src/ImageContentType.hs @@ -4,10 +4,10 @@ import Data.ByteString.Lazy (ByteString(..)) import Network.HTTP.Media ((//), (/:)) import Servant -data PNG +data IMG -instance Accept PNG where - contentType _ = "image" // "png" +instance Accept IMG where + contentType _ = "image" // "*" -instance MimeRender PNG ByteString where +instance MimeRender IMG ByteString where mimeRender _ val = val -- 2.20.1