Skip to content

Commit 76e9429

Browse files
Stop NoContent appearing in BodyTypes if it appears inside Headers
Recurse through `Headers hdrs` just like any other decorator that should be ignored.
1 parent 9aaeaf2 commit 76e9429

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Unreleased
2+
----------
3+
4+
* Do not count `NoContent` as a body type if it appears in `Headers
5+
hdrs NoContent`.
6+
17
1.1.8
28
-------
39

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ type AddBodyType c cs a as = If (Elem c cs) (a ': as) as
8686
-- completely empty on responses to requests that only accept 'application/json', while
8787
-- setting the content-type in the response accordingly.)
8888
type family BodyTypes' c api :: [*] where
89-
BodyTypes' c (Verb verb b cs (Headers hdrs a)) = AddBodyType c cs a '[]
89+
BodyTypes' c (Verb verb b cs (Headers hdrs a)) = BodyTypes' c (Verb verb b cs a)
9090
BodyTypes' c (Verb verb b cs NoContent) = '[]
9191
BodyTypes' c (Verb verb b cs a) = AddBodyType c cs a '[]
9292
BodyTypes' c (ReqBody' mods cs a :> api) = AddBodyType c cs a (BodyTypes' c api)

0 commit comments

Comments
 (0)