@@ -247,6 +247,8 @@ type ErrorChoiceApi
247 :<|> "path3" :> ReqBody '[JSON] Int :> Post '[PlainText] Int -- 3
247 :<|> "path3" :> ReqBody '[JSON] Int :> Post '[PlainText] Int -- 3
248 :<|> "path4" :> (ReqBody '[PlainText] Int :> Post '[PlainText] Int -- 4
248 :<|> "path4" :> (ReqBody '[PlainText] Int :> Post '[PlainText] Int -- 4
249 :<|> ReqBody '[PlainText] Int :> Post '[JSON] Int) -- 5
249 :<|> ReqBody '[PlainText] Int :> Post '[JSON] Int) -- 5
250+ :<|> "path5" :> (ReqBody '[JSON] Int :> Post '[PlainText] Int -- 6
251+ :<|> ReqBody '[PlainText] Int :> Post '[PlainText] Int) -- 7
251errorChoiceApi :: Proxy ErrorChoiceApi
253errorChoiceApi :: Proxy ErrorChoiceApi
252errorChoiceApi = Proxy
254errorChoiceApi = Proxy
@@ -256,8 +258,8 @@ errorChoiceServer = return 0
256 :<|> return 1
258 :<|> return 1
257 :<|> return 2
259 :<|> return 2
258 :<|> (\_ -> return 3)
260 :<|> (\_ -> return 3)
259− :<|> (\_ -> return 4)
261+ :<|> ((\_ -> return 4) :<|> (\_ -> return 5))
260− :<|> (\_ -> return 5)
262+ :<|> ((\_ -> return 6) :<|> (\_ -> return 7))
263errorChoiceSpec :: Spec
265errorChoiceSpec :: Spec
@@ -278,6 +280,13 @@ errorChoiceSpec = describe "Multiple handlers return errors"
278 request methodPost "path4" [(hContentType, "text/plain;charset=utf-8"),
280 request methodPost "path4" [(hContentType, "text/plain;charset=utf-8"),
279 (hAccept, "blah")] "5"
281 (hAccept, "blah")] "5"
280 `shouldRespondWith` 406
282 `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