http-conduit 2.3.7 → 2.3.7.1
raw patch · 4 files changed
+19/−7 lines, 4 filesdep ~warpPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: warp
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- Network/HTTP/Simple.hs +2/−1
- http-conduit.cabal +1/−1
- test/main.hs +12/−5
ChangeLog.md view
@@ -1,5 +1,9 @@ # ChangeLog for http-conduit +## 2.3.7.1++* Properly skip whitespace after JSON body [#401](https://github.com/snoyberg/http-client/issues/401)+ ## 2.3.7 * Ensure entire JSON response body is consumed [#395](https://github.com/snoyberg/http-client/issues/395)
Network/HTTP/Simple.hs view
@@ -106,6 +106,7 @@ import qualified Control.Exception as E (bracket) import Data.Void (Void) import qualified Data.Attoparsec.ByteString as Atto+import qualified Data.Attoparsec.ByteString.Char8 as Atto8 -- | Perform an HTTP request and return the body as a @ByteString@. --@@ -153,7 +154,7 @@ where req' = addRequestHeader H.hAccept "application/json" req sink orig = fmap (\x -> fmap (const x) orig) $ do- eres1 <- C.sinkParserEither (json' <* Atto.endOfInput)+ eres1 <- C.sinkParserEither (json' <* (Atto8.skipSpace *> Atto.endOfInput)) case eres1 of Left e -> return $ Left $ JSONParseException req' orig e
http-conduit.cabal view
@@ -1,5 +1,5 @@ name: http-conduit-version: 2.3.7+version: 2.3.7.1 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>
test/main.hs view
@@ -463,11 +463,15 @@ res <- I.readIORef ref res `shouldBe` qs - describe "Simple" $ do- it "JSON" $ jsonApp $ \port -> do+ describe "Simple.JSON" $ do+ it "normal" $ jsonApp $ \port -> do req <- parseUrlThrow $ "http://localhost:" ++ show port value <- Simple.httpJSON req responseBody value `shouldBe` jsonValue+ it "trailing whitespace" $ jsonApp $ \port -> do+ req <- parseUrlThrow $ "http://localhost:" ++ show port ++ "/trailing"+ value <- Simple.httpJSON req+ responseBody value `shouldBe` jsonValue it "RequestBodyIO" $ echo $ \port -> do manager <- newManager tlsManagerSettings@@ -607,11 +611,14 @@ src = yield bs jsonApp :: (Int -> IO ()) -> IO ()-jsonApp = withApp $ \_req -> return $ responseLBS+jsonApp = withApp $ \req -> return $ responseLBS status200 [ ("Content-Type", "application/json")- ]- (A.encode jsonValue)+ ] $+ case pathInfo req of+ [] -> A.encode jsonValue+ ["trailing"] -> A.encode jsonValue <> " \n\r\n\t "+ x -> error $ "unsupported: " ++ show x jsonValue :: A.Value jsonValue = A.object