@@ -247,6 +247,8 @@ type ErrorChoiceApi
247247 :<|> "path3" :> ReqBody '[JSON] Int :> Post '[PlainText] Int -- 3
248248 :<|> "path4" :> (ReqBody '[PlainText] Int :> Post '[PlainText] Int -- 4
249249 :<|> ReqBody '[PlainText] Int :> Post '[JSON] Int) -- 5
250+ :<|> "path5" :> (ReqBody '[JSON] Int :> Post '[PlainText] Int -- 6
251+ :<|> ReqBody '[PlainText] Int :> Post '[PlainText] Int) -- 7
250252
251253errorChoiceApi :: Proxy ErrorChoiceApi
252254errorChoiceApi = Proxy
@@ -256,8 +258,8 @@ errorChoiceServer = return 0
256258 :<|> return 1
257259 :<|> return 2
258260 :<|> (\_ -> return 3)
259− :<|> (\_ -> return 4)
260− :<|> (\_ -> return 5)
261+ :<|> ((\_ -> return 4) :<|> (\_ -> return 5))
262+ :<|> ((\_ -> return 6) :<|> (\_ -> return 7))
261263
262264
263265errorChoiceSpec :: Spec
@@ -278,6 +280,13 @@ errorChoiceSpec = describe "Multiple handlers return errors"
278280 request methodPost "path4" [(hContentType, "text/plain;charset=utf-8"),
279281 (hAccept, "blah")] "5"
280282 `shouldRespondWith` 406
283+ it "should respond with 415 only if none of the subservers supports the request's content type" $ do
284+ request methodPost "path5" [(hContentType, "text/plain;charset=utf-8")] "1"
285+ `shouldRespondWith` 200
286+ request methodPost "path5" [(hContentType, "application/json")] "1"
287+ `shouldRespondWith` 200
288+ request methodPost "path5" [(hContentType, "application/not-supported")] ""
289+ `shouldRespondWith` 415
281290
282291
283292-- }}}