Skip to content

Commit d97896c

Browse files
committed
Fix: validateEveryToJSON handles NoContent specially.
1 parent 98ff31c commit d97896c

File tree

1 file changed

+5
-0
lines changed
  • src/Servant/Swagger/Internal/TypeLevel

1 file changed

+5
-0
lines changed

src/Servant/Swagger/Internal/TypeLevel/API.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,13 @@ type AddBodyType c cs a as = If (Elem c cs) (a ': as) as
7272

7373
-- | Extract a list of "body" types for a specific content-type from a servant API.
7474
-- To extract unique types see @'BodyTypes'@.
75+
--
76+
-- @'NoContent'@ is removed from the list and not tested. (This allows for leaving the body
77+
-- completely empty on responses to requests that only accept 'application/json', while
78+
-- setting the content-type in the response accordingly.)
7579
type family BodyTypes' c api :: [*] where
7680
BodyTypes' c (Verb verb b cs (Headers hdrs a)) = AddBodyType c cs a '[]
81+
BodyTypes' c (Verb verb b cs NoContent) = '[]
7782
BodyTypes' c (Verb verb b cs a) = AddBodyType c cs a '[]
7883
BodyTypes' c (ReqBody' mods cs a :> api) = AddBodyType c cs a (BodyTypes' c api)
7984
BodyTypes' c (e :> api) = BodyTypes' c api

0 commit comments

Comments
 (0)