on master help sign in
Change the signature of ‘makeResponseBodyPreview’
2a28b2amrkkrp
CHANGELOG.md+5
@@ -1,3 +1,8 @@
1+## Req 0.5.0
2+
3+* Changed the signature of the `makeResponseBodyPreview` from `response ->
4+ IO ByteString` to `ByteString`.
5+
1## Req 0.4.0
6## Req 0.4.0
2
7
3* Added the `Req` monad and `runReq` function to run it. This allows to use
8* Added the `Req` monad and `runReq` function to run it. This allows to use
Network/HTTP/Req.hs+7−7
@@ -569,8 +569,8 @@ instance Default HttpConfig where
569 , httpConfigCheckResponse = \_ response ->
569 , httpConfigCheckResponse = \_ response ->
570 let statusCode = responseStatusCode response in
570 let statusCode = responseStatusCode response in
571 unless (200 <= statusCode && statusCode < 300) $ do
571 unless (200 <= statusCode && statusCode < 300) $ do
572− chunk <- makeResponseBodyPreview response
572+ let chunk = makeResponseBodyPreview response
573− let vresponse = toVanillaResponse response
573+ vresponse = toVanillaResponse response
574 LI.throwHttp (L.StatusCodeException (void vresponse) chunk)
574 LI.throwHttp (L.StatusCodeException (void vresponse) chunk)
575 , httpConfigRetryPolicy = def
575 , httpConfigRetryPolicy = def
576 , httpConfigRetryJudge = \_ r -> return $
576 , httpConfigRetryJudge = \_ r -> return $
@@ -1346,7 +1346,7 @@ instance HttpResponse IgnoreResponse where
1346 toVanillaResponse (IgnoreResponse response) = response
1346 toVanillaResponse (IgnoreResponse response) = response
1347 getHttpResponse request manager =
1347 getHttpResponse request manager =
1348 IgnoreResponse <$> liftIO (L.httpNoBody request manager)
1348 IgnoreResponse <$> liftIO (L.httpNoBody request manager)
1349− makeResponseBodyPreview _ = return "<ignored response>"
1349+ makeResponseBodyPreview _ = "<ignored response>"
1350
1350
1351-- | Use this as the fourth argument of 'req' to specify that you want it to
1351-- | Use this as the fourth argument of 'req' to specify that you want it to
1352-- return the 'IgnoreResponse' interpretation.
1352-- return the 'IgnoreResponse' interpretation.
@@ -1375,7 +1375,7 @@ instance FromJSON a => HttpResponse (JsonResponse a) where
1375 . L.responseBody
1375 . L.responseBody
1376 $ response
1376 $ response
1377 return $ JsonResponse response { L.responseBody = x } preview
1377 return $ JsonResponse response { L.responseBody = x } preview
1378− makeResponseBodyPreview (JsonResponse _ preview) = return preview
1378+ makeResponseBodyPreview (JsonResponse _ preview) = preview
1379
1379
1380-- | Use this as the forth argument of 'req' to specify that you want it to
1380-- | Use this as the forth argument of 'req' to specify that you want it to
1381-- return the 'JsonResponse' interpretation.
1381-- return the 'JsonResponse' interpretation.
@@ -1394,7 +1394,7 @@ instance HttpResponse BsResponse where
1394 L.withResponse request manager $ \response -> do
1394 L.withResponse request manager $ \response -> do
1395 chunks <- L.brConsume (L.responseBody response)
1395 chunks <- L.brConsume (L.responseBody response)
1396 return $ BsResponse response { L.responseBody = B.concat chunks }
1396 return $ BsResponse response { L.responseBody = B.concat chunks }
1397− makeResponseBodyPreview = return . B.take bodyPreviewLength . responseBody
1397+ makeResponseBodyPreview = B.take bodyPreviewLength . responseBody
1398
1398
1399-- | Use this as the forth argument of 'req' to specify that you want to
1399-- | Use this as the forth argument of 'req' to specify that you want to
1400-- interpret response body as a strict 'ByteString'.
1400-- interpret response body as a strict 'ByteString'.
@@ -1412,7 +1412,7 @@ instance HttpResponse LbsResponse where
1412 toVanillaResponse (LbsResponse response) = response
1412 toVanillaResponse (LbsResponse response) = response
1413 getHttpResponse request manager =
1413 getHttpResponse request manager =
1414 LbsResponse <$> L.httpLbs request manager
1414 LbsResponse <$> L.httpLbs request manager
1415− makeResponseBodyPreview = return . BL.toStrict . BL.take 1027 . responseBody
1415+ makeResponseBodyPreview = BL.toStrict . BL.take 1027 . responseBody
1416
1416
1417-- | Use this as the forth argument of 'req' to specify that you want to
1417-- | Use this as the forth argument of 'req' to specify that you want to
1418-- interpret response body as a lazy 'BL.ByteString'.
1418-- interpret response body as a lazy 'BL.ByteString'.
@@ -1500,7 +1500,7 @@ class HttpResponse response where
1500 --
1500 --
1501 -- @since 0.3.0
1501 -- @since 0.3.0
1502
1502
1503− makeResponseBodyPreview :: response -> IO ByteString
1503+ makeResponseBodyPreview :: response -> ByteString
1504
1504
1505----------------------------------------------------------------------------
1505----------------------------------------------------------------------------
1506-- Other
1506-- Other