handle http(s)://
This commit is contained in:
parent
57ee8a1296
commit
ffb24509d7
@ -71,15 +71,15 @@ getSmartSourceSpec defaultDirectory defaultFile spec
|
||||
smartSource (FilePathSpec filePath) = sourceFile filePath
|
||||
smartSource Stdin = sourceHandle stdin
|
||||
smartSource NoSource = error $ "should not be here"
|
||||
smartSource (Http url) = httpSource url
|
||||
smartSource (Https url) = httpSource url
|
||||
|
||||
-- httpSource :: MonadResource m => String -> ConduitM () S.ByteString m ()
|
||||
-- httpSource url = do
|
||||
-- request <- liftIO $ parseRequest url
|
||||
-- manager <- liftIO $ newManager tlsManagerSettings
|
||||
-- response <- lift $ http request manager
|
||||
-- (httpsource, finalizer) <- lift $ unwrapResumable (responseBody response)
|
||||
-- httpsource
|
||||
-- lift finalizer
|
||||
httpSource :: MonadResource m => String -> ConduitM () S.ByteString m ()
|
||||
httpSource url = do
|
||||
request <- liftIO $ parseRequest url
|
||||
manager <- liftIO $ newManager tlsManagerSettings
|
||||
response <- lift $ http request manager
|
||||
responseBody response
|
||||
|
||||
checkRefFormat :: String -> Bool
|
||||
checkRefFormat ref =
|
||||
|
@ -309,8 +309,8 @@ main = hspec $ do
|
||||
getSmartSourceSpec "foo" "in.tsv" "https://gonito.net" `shouldReturn` (Right $ Https "https://gonito.net")
|
||||
it "sources are accessed" $ do
|
||||
readFromSmartSource "baz" "out.tsv" "test/files/foo.txt" `shouldReturn` ["foo\n"]
|
||||
-- readFromSmartSource [] Nothing "https://httpbin.org/robots.txt" `shouldReturn`
|
||||
-- ["User-agent: *\nDisallow: /deny\n"]
|
||||
readFromSmartSource "" "" "https://httpbin.org/robots.txt" `shouldReturn`
|
||||
["User-agent: *\nDisallow: /deny\n"]
|
||||
|
||||
readFromSmartSource :: FilePath -> FilePath -> String -> IO [String]
|
||||
readFromSmartSource defaultDir defaultFile specS = do
|
||||
|
Loading…
Reference in New Issue
Block a user