packages feed

servant-client 0.12 → 0.12.0.1

raw patch · 3 files changed

+20/−3 lines, 3 filesdep ~http-types

Dependency ranges changed: http-types

Files

CHANGELOG.md view
@@ -1,6 +1,12 @@ [The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant-client/CHANGELOG.md) [Changelog for `servant` package contains significant entries for all core packages.](https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md) +0.12.0.1+--------++- Send `Accept` header.+  ([#858](https://github.com/haskell-servant/servant/issues/858))+ 0.12 ---- 
servant-client.cabal view
@@ -1,5 +1,5 @@ name:                servant-client-version:             0.12+version:             0.12.0.1 synopsis: automatical derivation of querying functions for servant webservices description:   This library lets you derive automatically Haskell functions that
src/Servant/Client/Internal/HttpClient.hs view
@@ -28,6 +28,7 @@ import qualified Data.ByteString.Lazy        as BSL import           Data.Foldable               (toList) import           Data.Functor.Alt            (Alt (..))+import           Data.Maybe                  (maybeToList) import           Data.Monoid                 ((<>)) import           Data.Proxy                  (Proxy (..)) import           Data.Sequence               (fromList)@@ -133,16 +134,26 @@                <> toLazyByteString (requestPath r)   , Client.queryString = renderQuery True . toList $ requestQueryString r   , Client.requestHeaders =-      let orig = toList $ requestHeaders r-      in maybe orig (: orig) contentTypeHdr+    maybeToList acceptHdr ++ maybeToList contentTypeHdr ++ headers   , Client.requestBody = body   , Client.secure = isSecure   }   where+    -- Content-Type and Accept are specified by requestBody and requestAccept+    headers = filter (\(h, _) -> h /= "Accept" && h /= "Content-Type") $+        toList $requestHeaders r++    acceptHdr+        | null hs   = Nothing+        | otherwise = Just ("Accept", renderHeader hs)+      where+        hs = toList $ requestAccept r+     (body, contentTypeHdr) = case requestBody r of       Nothing -> (Client.RequestBodyLBS "", Nothing)       Just (RequestBodyLBS body', typ)         -> (Client.RequestBodyLBS body', Just (hContentType, renderHeader typ))+     isSecure = case baseUrlScheme burl of       Http -> False       Https -> True