2b737e4c1c
When defining a route like the following, ``` type API = Get '[JSON, PlainText] Int ``` servant-client is only able to receive responses with the content type that comes first in the list. In this example, it will only be able to receive `application/json` responses. This PR changes it so that servant-client will accept _any_ content-type in the list. In the example above, it will accept responses with a content type of `application/json` or `text/plain`. |
||
---|---|---|
.. | ||
include | ||
src/Servant | ||
test | ||
CHANGELOG.md | ||
docs.sh | ||
LICENSE | ||
README.md | ||
servant-client.cabal | ||
Setup.hs | ||
tinc.yaml |
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 :: Manager -> BaseUrl -> ExceptT String IO [Book]
postNewBook :: Book -> Manager -> BaseUrl -> ExceptT String IO Book
-- 'client' allows you to produce operations to query an API from a client.
(getAllBooks :<|> postNewBook) = client myApi