haskell-servant / servant-quickcheck

40 stars 21 forks source link

Fix a failure from OnlyJsonObjects when there is no content-type. #55

Closed ghost closed 5 years ago

ghost commented 5 years ago

It can happen that during testing with servant-quickcheck, the server will answer a response with no content-type header (e.g. a 502 or 405 response). The OnlyJsonObjects predicate considered these cases as a failure for itself, which made no sense since the responses hold no content.

This PR aims at fixing that, by first adding a check that verifies this behavior does not happen, and then fixing the predicate. (I also believe the new predicate is clearer to read, but that's opinion).

ghost commented 5 years ago

(I failed my rebase on upstream, so it's diffed from v5, but since it doesn't generate any conflicts I didn't think it necessary to fix that)