servant/servant-server/test/Servant/Server
Andres Loeh a551eb62e2 Do the accept check before the body check.
This is a reasonably simple attempt at fixing #460.
By moving the accept check to a place before the body check,
we can make it recoverable (the body check is irreversible,
so everything done after the body check has to fail fatally).

The advantage is that we can now specify routes offering
different content types modularly. Failure to match one
is not fatal, and will result in subsequent routes being
tried.

The disadvantage is that we hereby bump the error priority
of the 406 status code. If a request contains a bad accept
header and a bad body, we now get 406 rather than 400. This
deviates from the HTTP decision diagram we try to follow,
but seems like an acceptable compromise for now.
2016-04-15 10:54:22 +02:00
..
Internal Introduce a Handler alias for ExceptT ServantErr IO 2016-04-11 22:27:29 -07:00
UsingContextSpec Revise the Router type to allow proper sharing. 2016-04-12 09:38:49 +02:00
ErrorSpec.hs Do the accept check before the body check. 2016-04-15 10:54:22 +02:00
RouterSpec.hs Revise the Router type to allow proper sharing. 2016-04-12 09:38:49 +02:00
StreamingSpec.hs Introduce a Handler alias for ExceptT ServantErr IO 2016-04-11 22:27:29 -07:00
UsingContextSpec.hs Introduce a Handler alias for ExceptT ServantErr IO 2016-04-11 22:27:29 -07:00