summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodrigosetti <>2017-09-13 00:02:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-09-13 00:02:00 (GMT)
commit92045fbeec8c5aa1d128d6eb3db52d4a55e7e5a5 (patch)
treed88bb83f53b371f7f1cb062f935816aceb074b18
parent7f5c35b7a4a60d628eb63d90f1e40d8090c03642 (diff)
version 0.2.7HEAD0.2.7master
-rw-r--r--src/Test/Swagger/Gen.hs7
-rw-r--r--src/Test/Swagger/Print.hs6
-rw-r--r--swagger-test.cabal2
3 files changed, 9 insertions, 6 deletions
diff --git a/src/Test/Swagger/Gen.hs b/src/Test/Swagger/Gen.hs
index b52f0f2..e707473 100644
--- a/src/Test/Swagger/Gen.hs
+++ b/src/Test/Swagger/Gen.hs
@@ -129,7 +129,7 @@ requestGenerator ns mopid =
let randomHeaders' = catMaybes
$ (\h -> (fst h,) <$> snd h)
<$> ((mk . fst &&& snd) <$> randomHeaders)
- <> [("Host", (T.pack . (^. name)) <$> mHost)]
+ <> [("Host", (T.pack . hostNameAndPort) <$> mHost)]
<> [("Content-Type", fst <$> maybeMimeAndBody)]
<> [("User-Agent", Just $ "swagger-test/" <> T.pack (showVersion version))]
@@ -149,7 +149,10 @@ requestGenerator ns mopid =
schemeForPort _ = Http
buildHost :: Scheme -> Host -> String
- buildHost sc h = schemeToHttpPrefix sc <> (h ^. name) <> maybe "" ((':':) . show) (h ^. port)
+ buildHost sc h = schemeToHttpPrefix sc <> hostNameAndPort h
+
+ hostNameAndPort :: Host -> String
+ hostNameAndPort h = (h ^. name) <> maybe "" ((':':) . show) (h ^. port)
schemeToHttpPrefix Http = "http://"
schemeToHttpPrefix Https = "https://"
diff --git a/src/Test/Swagger/Print.hs b/src/Test/Swagger/Print.hs
index 268fb18..23c5fe7 100644
--- a/src/Test/Swagger/Print.hs
+++ b/src/Test/Swagger/Print.hs
@@ -52,9 +52,9 @@ printRequest FormatHttp (HttpRequest _ method path query headers body) =
Nothing -> mempty
printRequest FormatCurl (HttpRequest host method path query headers body) =
fromText "curl -i"
- <> if method /= methodGet
- then fromUtf8Bytestring $ " -X " <> method
- else mempty
+ <> (if method /= methodGet
+ then fromUtf8Bytestring $ " -X " <> method
+ else mempty)
<> fromText " '"
<> fromText (escapeS host')
<> fromText (escape path)
diff --git a/swagger-test.cabal b/swagger-test.cabal
index 83ee4fc..7f75539 100644
--- a/swagger-test.cabal
+++ b/swagger-test.cabal
@@ -1,5 +1,5 @@
name: swagger-test
-version: 0.2.6
+version: 0.2.7
synopsis: Testing of Swagger APIs
description: This package provides a library and executable tool
that supports testing APIs specified with Swagger. It