Skip to content

Commit eabcbd5

Browse files
Allow restricting number of redirects (#65)
1 parent 9da39d7 commit eabcbd5

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: curl-runnings
2-
version: 0.14.0
2+
version: 0.15.0
33
github: aviaviavi/curl-runnings
44
license: MIT
55
author: Avi Press

src/Testing/CurlRunnings.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ runCase state@(CurlRunningsState _ _ _ tlsCheckType) curlCase = do
116116
setRequestHeaders (toHTTPHeaders interpolatedHeaders) .
117117
appendQueryParameters interpolatedQueryParams .
118118
(if tlsCheckType == DoTLSCheck then id else (setRequestManager manager)) $
119-
initReq {method = B8S.pack . show $ requestMethod curlCase}
119+
initReq { method = B8S.pack . show $ requestMethod curlCase
120+
, redirectCount = fromMaybe 10 (allowedRedirects curlCase) }
120121
logger state DEBUG (pShow request)
121122
logger
122123
state

src/Testing/CurlRunnings/Types.hs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,17 @@ instance ToJSON Authentication
209209

210210
-- | A single curl test case, the basic foundation of a curl-runnings test.
211211
data CurlCase = CurlCase
212-
{ name :: T.Text -- ^ The name of the test case
213-
, url :: T.Text -- ^ The target url to test
214-
, requestMethod :: HttpMethod -- ^ Verb to use for the request
215-
, requestData :: Maybe Payload -- ^ Payload to send with the request, if any
216-
, queryParameters :: Maybe KeyValuePairs -- ^ Query parameters to set in the request, if any
217-
, headers :: Maybe Headers -- ^ Headers to send with the request, if any
218-
, auth :: Maybe Authentication -- ^ Authentication to add to the request, if any
219-
, expectData :: Maybe JsonMatcher -- ^ The assertions to make on the response payload, if any
220-
, expectStatus :: StatusCodeMatcher -- ^ Assertion about the status code returned by the target
221-
, expectHeaders :: Maybe HeaderMatcher -- ^ Assertions to make about the response headers, if any
212+
{ name :: T.Text -- ^ The name of the test case
213+
, url :: T.Text -- ^ The target url to test
214+
, requestMethod :: HttpMethod -- ^ Verb to use for the request
215+
, requestData :: Maybe Payload -- ^ Payload to send with the request, if any
216+
, queryParameters :: Maybe KeyValuePairs -- ^ Query parameters to set in the request, if any
217+
, headers :: Maybe Headers -- ^ Headers to send with the request, if any
218+
, auth :: Maybe Authentication -- ^ Authentication to add to the request, if any
219+
, expectData :: Maybe JsonMatcher -- ^ The assertions to make on the response payload, if any
220+
, expectStatus :: StatusCodeMatcher -- ^ Assertion about the status code returned by the target
221+
, expectHeaders :: Maybe HeaderMatcher -- ^ Assertions to make about the response headers, if any
222+
, allowedRedirects :: Maybe Int -- ^ Number of redirects to follow. Defaults to 10
222223
} deriving (Show, Generic)
223224

224225
instance FromJSON CurlCase

0 commit comments

Comments
 (0)