summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphadej <>2019-04-16 12:03:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-04-16 12:03:00 (GMT)
commite5cfbef1f4cec561124469eb94fd1c3c79e3ffa2 (patch)
treee64ece25e667b7780df43f498fad7b24c97d6eaf
parent479fdcef04c0e8d74c50d19babeb26af332cd213 (diff)
version 0.16.0.10.16.0.1
-rwxr-xr-xCHANGELOG.md31
-rw-r--r--servant.cabal15
-rw-r--r--test/Servant/API/ContentTypesSpec.hs23
3 files changed, 44 insertions, 25 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 727a7cd..042d6a9 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
[The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md)
+0.16.0.1
+--------
+
+- Make tests work with `http-media-0.8`
+
0.16
----
@@ -203,18 +208,18 @@
[#985](https://github.com/haskell-servant/servant/pull/985)
- *Documentation* Tutorial and new recipes
- - [Using free client](https://haskell-servant.readthedocs.io/en/latest/cookbook/using-free-client/UsingFreeClient.html)
+ - [Using free client](https://docs.servant.dev/en/latest/cookbook/using-free-client/UsingFreeClient.html)
[#1005](https://github.com/haskell-servant/servant/pull/1005)
- - [Generating mock curl calls](https://haskell-servant.readthedocs.io/en/latest/cookbook/curl-mock/CurlMock.html)
+ - [Generating mock curl calls](https://docs.servant.dev/en/latest/cookbook/curl-mock/CurlMock.html)
[#1033](https://github.com/haskell-servant/servant/pull/1033)
- - [Error logging with Sentry](https://haskell-servant.readthedocs.io/en/latest/cookbook/sentry/Sentry.html)
+ - [Error logging with Sentry](https://docs.servant.dev/en/latest/cookbook/sentry/Sentry.html)
[#987](https://github.com/haskell-servant/servant/pull/987)
- - [Hoist Server With Context for Custom Monads](https://haskell-servant.readthedocs.io/en/latest/cookbook/hoist-server-with-context/HoistServerWithContext.html)
+ - [Hoist Server With Context for Custom Monads](https://docs.servant.dev/en/latest/cookbook/hoist-server-with-context/HoistServerWithContext.html)
[#1044](https://github.com/haskell-servant/servant/pull/1044)
- - [How To Test Servant Applications](https://haskell-servant.readthedocs.io/en/latest/cookbook/testing/Testing.html)
+ - [How To Test Servant Applications](https://docs.servant.dev/en/latest/cookbook/testing/Testing.html)
[#1050](https://github.com/haskell-servant/servant/pull/1050)
- `genericServeT`: using custom monad with `Servant.API.Generic`
- in [Using generics](https://haskell-servant.readthedocs.io/en/latest/cookbook/generic/Generic.html)
+ in [Using generics](https://docs.servant.dev/en/latest/cookbook/generic/Generic.html)
[#1058](https://github.com/haskell-servant/servant/pull/1058)
- Tutorial
[#974](https://github.com/haskell-servant/servant/pull/974)
@@ -282,7 +287,7 @@
Just like `hoistServer` allows us to change the monad in which request handlers
of a web application live in, we also have `hoistClient` for changing the monad
in which *client functions* live.
- Read [tutorial section for more information](https://haskell-servant.readthedocs.io/en/release-0.14/tutorial/Client.html#changing-the-monad-the-client-functions-live-in).
+ Read [tutorial section for more information](https://docs.servant.dev/en/release-0.14/tutorial/Client.html#changing-the-monad-the-client-functions-live-in).
([#936](https://github.com/haskell-servant/servant/pull/936))
iF you have own combinators, you'll need to define a new method of
@@ -329,10 +334,10 @@
- Added tests or enabled tests
([#975](https://github.com/haskell-servant/servant/pull/975))
-- Add [pagination cookbook recipe](https://haskell-servant.readthedocs.io/en/release-0.14/cookbook/pagination/Pagination.html)
+- Add [pagination cookbook recipe](https://docs.servant.dev/en/release-0.14/cookbook/pagination/Pagination.html)
([#946](https://github.com/haskell-servant/servant/pull/946))
-- Add [`servant-flatten` "spice" to the structuring api recipe](https://haskell-servant.readthedocs.io/en/release-0.14/cookbook/structuring-apis/StructuringApis.html)
+- Add [`servant-flatten` "spice" to the structuring api recipe](https://docs.servant.dev/en/release-0.14/cookbook/structuring-apis/StructuringApis.html)
([#929](https://github.com/haskell-servant/servant/pull/929))
- Dependency updates
@@ -382,9 +387,9 @@
```
See tutorial for more details
- - [A web API as a type - StreamGet and StreamPost](http://haskell-servant.readthedocs.io/en/release-0.13/tutorial/ApiType.html#streamget-and-streampost)
- - [Serving an API - streaming endpoints](http://haskell-servant.readthedocs.io/en/release-0.13/tutorial/Server.html#streaming-endpoints)
- - [Querying an API - Querying Streaming APIs](http://haskell-servant.readthedocs.io/en/release-0.13/tutorial/Client.html#querying-streaming-apis)
+ - [A web API as a type - StreamGet and StreamPost](http://docs.servant.dev/en/release-0.13/tutorial/ApiType.html#streamget-and-streampost)
+ - [Serving an API - streaming endpoints](http://docs.servant.dev/en/release-0.13/tutorial/Server.html#streaming-endpoints)
+ - [Querying an API - Querying Streaming APIs](http://docs.servant.dev/en/release-0.13/tutorial/Client.html#querying-streaming-apis)
- *servant* Add `Servant.API.Modifiers`
([#873](https://github.com/haskell-servant/servant/pull/873)
@@ -415,7 +420,7 @@
([#893](https://github.com/haskell-servant/servant/pull/893))
- *Cookbook* example projects at
- http://haskell-servant.readthedocs.io/en/master/cookbook/index.html
+ http://docs.servant.dev/en/master/cookbook/index.html
([#867](https://github.com/haskell-servant/servant/pull/867)
[#892](https://github.com/haskell-servant/servant/pull/882))
diff --git a/servant.cabal b/servant.cabal
index eb4257c..ebaafd9 100644
--- a/servant.cabal
+++ b/servant.cabal
@@ -1,17 +1,17 @@
cabal-version: >=1.10
name: servant
-version: 0.16
+version: 0.16.0.1
synopsis: A family of combinators for defining webservices APIs
category: Servant, Web
description:
A family of combinators for defining webservices APIs and serving them
.
- You can learn about the basics in the <http://haskell-servant.readthedocs.org/en/stable/tutorial/index.html tutorial>.
+ You can learn about the basics in the <http://docs.servant.dev/en/stable/tutorial/index.html tutorial>.
.
<https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md CHANGELOG>
-homepage: http://haskell-servant.readthedocs.org/
+homepage: http://docs.servant.dev/
bug-reports: http://github.com/haskell-servant/servant/issues
license: BSD3
license-file: LICENSE
@@ -24,7 +24,7 @@ tested-with:
GHC ==8.0.2
|| ==8.2.2
|| ==8.4.4
- || ==8.6.3
+ || ==8.6.4
extra-source-files:
CHANGELOG.md
@@ -110,11 +110,11 @@ library
, bifunctors >= 5.5.3 && < 5.6
, case-insensitive >= 1.2.0.11 && < 1.3
, deepseq >= 1.4.2.0 && < 1.5
- , http-media >= 0.7.1.3 && < 0.8
+ , http-media >= 0.7.1.3 && < 0.9
, http-types >= 0.12.2 && < 0.13
, mmorph >= 1.1.2 && < 1.2
, network-uri >= 2.6.1.0 && < 2.7
- , QuickCheck >= 2.12.6.1 && <2.13
+ , QuickCheck >= 2.12.6.1 && < 2.14
, string-conversions >= 0.4.0.1 && < 0.5
, tagged >= 0.8.6 && < 0.9
, vault >= 0.3.1.2 && < 0.4
@@ -161,6 +161,7 @@ test-suite spec
, base-compat
, aeson
, bytestring
+ , http-media
, mtl
, servant
, string-conversions
@@ -170,7 +171,7 @@ test-suite spec
-- Additonal dependencies
build-depends:
hspec >= 2.6.0 && < 2.8
- , QuickCheck >= 2.12.6.1 && < 2.13
+ , QuickCheck >= 2.12.6.1 && < 2.14
, quickcheck-instances >= 0.3.19 && < 0.4
build-tool-depends:
diff --git a/test/Servant/API/ContentTypesSpec.hs b/test/Servant/API/ContentTypesSpec.hs
index ecfcd7a..1a7d4d1 100644
--- a/test/Servant/API/ContentTypesSpec.hs
+++ b/test/Servant/API/ContentTypesSpec.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE MultiParamTypeClasses #-}
@@ -20,7 +21,7 @@ import Data.Either
import Data.Function
(on)
import Data.List
- (maximumBy)
+ (sortBy)
import qualified Data.List.NonEmpty as NE
import Data.Maybe
(fromJust, isJust, isNothing)
@@ -134,17 +135,29 @@ spec = describe "Servant.API.ContentTypes" $ do
== Just ("application/json;charset=utf-8", encode x)
it "respects the Accept spec ordering" $ do
- let highest a b c = maximumBy (compare `on` snd)
+ let highest a b c = last $ sortBy (compare `on` snd)
+-- when qualities are same, http-media-0.8 picks first; 0.7 last.
+#if MIN_VERSION_http_media(0,8,0)
+ [ ("text/plain;charset=utf-8", c)
+ , ("application/json;charset=utf-8", b)
+ , ("application/octet-stream", a)
+ ]
+#else
[ ("application/octet-stream", a)
, ("application/json;charset=utf-8", b)
, ("text/plain;charset=utf-8", c)
]
+#endif
let acceptH a b c = addToAccept (Proxy :: Proxy OctetStream) a $
- addToAccept (Proxy :: Proxy JSON) b $
- addToAccept (Proxy :: Proxy PlainText ) c ""
+ addToAccept (Proxy :: Proxy JSON) b $
+ addToAccept (Proxy :: Proxy PlainText ) c $
+ ""
let val a b c i = handleAcceptH (Proxy :: Proxy '[OctetStream, JSON, PlainText])
(acceptH a b c) (i :: Int)
- property $ \a b c i -> fst (fromJust $ val a b c i) == fst (highest a b c)
+ property $ \a b c i ->
+ let acc = acceptH a b c
+ in counterexample (show acc) $
+ fst (fromJust $ val a b c i) === fst (highest a b c)
describe "handleCTypeH" $ do