8cf4acf2fc
For some reason hspec-discover wasn't enabled for servant-client, causing test cases to be skipped and fasely reporting servant-client as test-passing whilst it was actually supposed to fail the tests. For example, we redefined BaseUrl recently to have a path field, but the tests don't reflect that yet but passed anyway. Because the test case wasn't even discovered and run. |
||
---|---|---|
.. | ||
src/Servant | ||
test | ||
CHANGELOG.md | ||
docs.sh | ||
LICENSE | ||
README.md | ||
servant-client.cabal | ||
Setup.hs |
servant-client
This library lets you automatically derive Haskell functions that let you query each endpoint of a servant webservice.
Example
type MyApi = "books" :> Get '[JSON] [Book] -- GET /books
:<|> "books" :> ReqBody Book :> Post '[JSON] Book -- POST /books
myApi :: Proxy MyApi
myApi = Proxy
getAllBooks :: ExceptT String IO [Book]
postNewBook :: Book -> ExceptT String IO Book
-- 'client' allows you to produce operations to query an API from a client.
(getAllBooks :<|> postNewBook) = client myApi host
where host = BaseUrl Http "localhost" 8080