diff --git a/src/GitHub/Data/Content.hs b/src/GitHub/Data/Content.hs index 7a4dca9b..1d28a0da 100644 --- a/src/GitHub/Data/Content.hs +++ b/src/GitHub/Data/Content.hs @@ -46,7 +46,7 @@ data ContentItem = ContentItem { instance NFData ContentItem where rnf = genericRnf instance Binary ContentItem -data ContentItemType = ItemFile | ItemDir +data ContentItemType = ItemFile | ItemSymlink | ItemDir deriving (Show, Data, Typeable, Eq, Ord, Generic) instance NFData ContentItemType where rnf = genericRnf @@ -149,9 +149,10 @@ instance FromJSON ContentItem where instance FromJSON ContentItemType where parseJSON = withText "ContentItemType" $ \t -> case T.toLower t of - "file" -> pure ItemFile - "dir" -> pure ItemDir - _ -> fail $ "Unknown ContentItemType: " <> T.unpack t + "file" -> pure ItemFile + "dir" -> pure ItemDir + "symlink" -> pure ItemSymlink + _ -> fail $ "Unknown ContentItemType: " <> T.unpack t instance FromJSON ContentInfo where parseJSON = withObject "ContentInfo" $ \o -> diff --git a/src/GitHub/Request.hs b/src/GitHub/Request.hs index 2481deea..1b7e531a 100644 --- a/src/GitHub/Request.hs +++ b/src/GitHub/Request.hs @@ -118,6 +118,8 @@ import GitHub.Data.Request import Paths_github (version) +import Control.Monad.IO.Class (liftIO) + ------------------------------------------------------------------------------- -- Convenience ------------------------------------------------------------------------------- @@ -235,6 +237,7 @@ executeRequestWithMgrAndRes mgr auth req = runExceptT $ do performHttpReq :: forall rw mt b. ParseResponse mt b => HTTP.Request -> GenRequest mt rw b -> ExceptT Error IO (HTTP.Response b) performHttpReq httpReq Query {} = do res <- httpLbs' httpReq + liftIO $ LBS.writeFile "response.json" (HTTP.responseBody res) (<$ res) <$> unTagged (parseResponse httpReq res :: Tagged mt (ExceptT Error IO b)) performHttpReq httpReq (PagedQuery _ _ l) =