on develop help sign in
Removing setMIMEType in favour of Body lens
commit1744a97b30cfd142adfa2ac693422bb14036d07a authorBrendan Hay <brendan.g.hay@gmail.com> dateSat 11 Jun 2016, 14:52 (10 years ago) parente437f32
2 files changed+3−3
core/src/Network/Google/Types.hs+2−2 examples/src/Example/Storage.hs+1−1
core/src/Network/Google/Types.hs+2−2
@@ -266,8 +266,8 @@ serviceTimeout = lens _svcTimeout (\s a -> s { _svcTimeout = a })
266266-- | A single part of a (potentially multipart) request body.
267267data Body = Body !MediaType !RequestBody
268268
269−setMIMEType :: MediaType -> Body -> Body
270−setMIMEType m (Body _ b) = Body m b
269+bodyContentType :: Lens' Body MediaType
270+bodyContentType = lens (\(Body m _) -> m) (\(Body _ b) m -> Body m b)
271271
272272-- | An intermediary request builder.
273273data Request = Request
examples/src/Example/Storage.hs+1−1
@@ -24,7 +24,7 @@ import System.IO
2424-- {-
2525-- import Network.HTTP.Media ((//))
2626----
27−-- b <- setMIMEType ("application" // "json") <$> sourceBody f
27+-- b <- sourceBody f <&> bodyContentType .~ ("application" // "json")
2828-- ...
2929--
3030-- -}