Use renderHeader to render the Accept header

This commit is contained in:
Timo von Holtz 2015-02-17 12:23:03 +11:00
parent 098b503625
commit a23204e134

View file

@ -93,10 +93,8 @@ reqToRequest req (BaseUrl reqScheme reqHost reqPort) =
setheaders r = r { requestHeaders = requestHeaders r
++ Prelude.map toProperHeader (headers req) }
setAccept r = r { requestHeaders = filter ((/= "Accept") . fst) (requestHeaders r)
++ [("Accept", BS.intercalate ", " (map renderAccept $ reqAccept req))
++ [("Accept", renderHeader $ reqAccept req)
| not . null . reqAccept $ req] }
renderAccept :: MediaType -> BS.ByteString
renderAccept m = BSC.pack (show m)
toProperHeader (name, val) =
(fromString name, encodeUtf8 val)