File tree Expand file tree Collapse file tree 3 files changed +25
-5
lines changed Expand file tree Collapse file tree 3 files changed +25
-5
lines changed Original file line number Diff line number Diff line change 2
2
--
3
3
-- see: https://github.com/sol/hpack
4
4
--
5
- -- hash: e6387b40a3da0bc0956a40390de8a48fca58d266b6a9865655e5dba0905f0088
5
+ -- hash: 2ef05b4af0ee7565019a5729c09d3a678a43e0cb2357bcd40a77a9b19b3aed2a
6
6
7
7
name : curl-runnings
8
- version : 0.9.0
8
+ version : 0.9.1
9
9
synopsis : A framework for declaratively writing curl based API tests
10
10
description : Please see the README on Github at <https://github.com/aviaviavi/curl-runnings#readme>
11
11
category : Testing
Original file line number Diff line number Diff line change 1
1
name : curl-runnings
2
- version : 0.9.0
2
+ version : 0.9.1
3
3
github : aviaviavi/curl-runnings
4
4
license : MIT
5
5
author : Avi Press
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ module Testing.CurlRunnings
9
9
, decodeFile
10
10
) where
11
11
12
+ import Control.Exception
12
13
import Control.Monad
13
14
import Data.Aeson
14
15
import Data.Aeson.Types
@@ -75,9 +76,28 @@ runCase state curlCase = do
75
76
DEBUG
76
77
(" Request body: " <> (pShow $ fromMaybe emptyObject replacedJSON))
77
78
response <- httpBS request
78
- logger state DEBUG (pShow response)
79
+ -- If the response is just returning bytes, we won't print them
80
+ let responseHeaderValues = map snd (getResponseHeaders response)
81
+ if " application/octet-stream" `notElem` responseHeaderValues &&
82
+ " application/vnd.apple.pkpass" `notElem` responseHeaderValues
83
+ then catch
84
+ (logger state DEBUG (pShow response))
85
+ (\ (e :: IOException ) ->
86
+ logger state ERROR (" Error logging response: " <> pShow e))
87
+ -- TODO: we should log as much info as possible without printing the raw body
88
+ else logger
89
+ state
90
+ DEBUG
91
+ " Response output supressed (returned content-type was bytes)"
79
92
returnVal <-
80
- (return . decode . B. fromStrict $ getResponseBody response) :: IO (Maybe Value )
93
+ catch
94
+ ((return . decode . B. fromStrict $ getResponseBody response) :: IO (Maybe Value ))
95
+ (\ (e :: IOException ) ->
96
+ logger
97
+ state
98
+ ERROR
99
+ (" Error decoding response into json: " <> pShow e) >>
100
+ return (Just Null ))
81
101
let returnCode = getResponseStatusCode response
82
102
receivedHeaders = fromHTTPHeaders $ responseHeaders response
83
103
assertionErrors =
You can’t perform that action at this time.
0 commit comments