Go to file
Nick B a5224276d5 Fix multiple QueryParams
* Add test API taking multiple `QueryParam`s
 * Add basic test using this API, generating an endpoint to ensure correct HTTP `one=foo&two=bar` query string generation is happening (that fails on `master`)
 * Fix (re)creation of query string to append `&` before the new parameter if there is already a built query string.

Fixes #23.
2017-03-06 13:32:55 +00:00
doc docs 2016-07-18 16:12:21 -03:00
src/Servant Fix multiple QueryParams 2017-03-06 13:32:55 +00:00
test Fix multiple QueryParams 2017-03-06 13:32:55 +00:00
.gitignore Add predicate getsHaveLastModifiedHeader. 2016-10-03 15:39:46 +02:00
.travis.yml Support new CaptureAll combinator. 2016-09-14 10:26:13 -03:00
CHANGELOG.yaml Bump version 2016-10-18 14:40:40 +02:00
LICENSE initial commit 2016-04-22 13:00:23 +02:00
README.md Add readme 2016-04-26 13:43:52 +02:00
servant-quickcheck.cabal Bump version 2016-10-18 14:40:40 +02:00
Setup.hs initial commit 2016-04-22 13:00:23 +02:00
stack-ghc-8.0.1.yaml Looser bounds. 2016-10-03 16:30:46 +02:00
stack.yaml support ghc 8 2016-09-14 09:37:14 -03:00

servant-quickcheck

servant-quickcheck provides tools to test properties across entire APIs. Rather than writing the same tests for each endpoint, with servant-quickcheck you can simply specify properties every endpoint must meet once and for all. For example:

followsBestPractices :: Spec
followsBestPractices = describe "my API" $ do

  it "follows best practices" $ do
    withServantServer myAPI myServer $ \burl ->
      serverSatisfies api burl stdArgs
           ( not500
         <%> onlyJsonObjects
         <%> getsHaveCacheControlHeader
         <%> headsHaveCacheControlHeader
         <%> mempty)

Additionally, servant-quickcheck provides a serversEqual function that generates arbitrary requests (that conform to the description of an API) and tests that two servers respond identically to them. This can be useful when refactoring or rewriting an API that should not change.