From 0cf49bb8b604dfd8a0b6e1089e74ac11322749ed Mon Sep 17 00:00:00 2001 From: Feynman Liang Date: Thu, 6 Apr 2017 08:43:56 -0700 Subject: [PATCH] Adds application/json to inspect type (#853) --- CHANGELOG.md | 1 + src/PostgREST/App.hs | 2 +- src/PostgREST/OpenAPI.hs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bd2281a2..236bb3f69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added - Allow requesting binary output on GET - @steve-chavez +- Accept clients requesting `Content-Type: application/json` from / - @feynmanliang ### Fixed diff --git a/src/PostgREST/App.hs b/src/PostgREST/App.hs index ba3c37579..e223ba745 100644 --- a/src/PostgREST/App.hs +++ b/src/PostgREST/App.hs @@ -284,7 +284,7 @@ responseContentTypeOrError accepts action = serves contentTypesForRequest accept ActionUpdate -> [CTApplicationJSON, CTSingularJSON, CTTextCSV] ActionDelete -> [CTApplicationJSON, CTSingularJSON, CTTextCSV] ActionInvoke -> [CTApplicationJSON, CTSingularJSON] - ActionInspect -> [CTOpenAPI] + ActionInspect -> [CTOpenAPI, CTApplicationJSON] ActionInfo -> [CTTextCSV] serves sProduces cAccepts = case mutuallyAgreeable sProduces cAccepts of diff --git a/src/PostgREST/OpenAPI.hs b/src/PostgREST/OpenAPI.hs index 2a21273a2..f20a1411a 100644 --- a/src/PostgREST/OpenAPI.hs +++ b/src/PostgREST/OpenAPI.hs @@ -237,7 +237,7 @@ makeRootPathItem = ("/", p) where getOp = (mempty :: Operation) & tags .~ Set.fromList ["/"] - & produces ?~ makeMimeList [CTOpenAPI] + & produces ?~ makeMimeList [CTOpenAPI, CTApplicationJSON] & at 200 ?~ "OK" pr = (mempty :: PathItem) & get ?~ getOp p = pr