Reponse with the correct header for openapi

This commit is contained in:
Jacky Hu
2016-06-18 10:18:43 +08:00
parent fd0b354cd0
commit 0be5f5299f
+5 -1
View File
@@ -208,8 +208,9 @@ app dbStructure conf apiRequest =
host = configHost conf
port = toInteger $ configPort conf
encodeFn = if contentType == OpenAPI then encodeApi . toTableInfo else encode
header = if contentType == OpenAPI then openapiH else jsonH
body <- encodeFn <$> H.query schema accessibleTables
return $ responseLBS status200 [jsonH] $ cs body
return $ responseLBS status200 [header] $ cs body
(ActionInappropriate, _, _) -> return $ responseLBS status405 [] ""
@@ -286,6 +287,9 @@ contentRangeH frm to total =
jsonH :: Header
jsonH = (hContentType, "application/json; charset=utf-8")
openapiH :: Header
openapiH = (hContentType, "application/openapi+json; charset=utf-8")
formatRelationError :: Text -> Text
formatRelationError = formatGeneralError
"could not find foreign keys between these entities"