Introduce the OpenAPI header

Also bring back the original behavior of GET "/"
This commit is contained in:
Jacky Hu
2016-06-18 10:18:43 +08:00
parent 103fa0550c
commit d1ed884a8d
6 changed files with 64 additions and 13 deletions
+3 -1
View File
@@ -204,7 +204,9 @@ app dbStructure conf apiRequest =
else return notFound
(ActionRead, TargetRoot, Nothing) -> do
body <- (encodeApi . toTableInfo) <$> H.query schema accessibleTables
body <- if contentType == OpenAPI
then (encodeApi . toTableInfo) <$> H.query schema accessibleTables
else encode <$> H.query schema accessibleTables
return $ responseLBS status200 [jsonH] $ cs body
(ActionInappropriate, _, _) -> return $ responseLBS status405 [] ""