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