http-directory 0.1.11 → 0.1.12
raw patch · 5 files changed
+17/−8 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Network.HTTP.Directory: data () => Manager
+ Network.HTTP.Directory: data Manager
Files
- CHANGELOG.md +4/−0
- README.md +2/−3
- http-directory.cabal +1/−1
- src/Network/HTTP/Directory.hs +5/−3
- test/Spec.hs +5/−1
CHANGELOG.md view
@@ -2,6 +2,10 @@ `http-directory` uses [PVP Versioning](https://pvp.haskell.org). +## 0.1.12 (2025-11-20)+- send HTTP directory requests with `"Accept: text/html"`+- send HTTP HEAD requests with `"Accept: */*"`+ ## 0.1.11 (2025-02-08) - add httpFileSizeAndTime' - tests: switch from httpbingo to httpbin.org/redirect
README.md view
@@ -20,9 +20,8 @@ ## Usage examples ```shellsession-Network.HTTP.Directory> httpDirectory' "https://hackage.haskell.org/package/base/src/System"-["CPUTime.hsc","Environment.hs","Exit.hs","IO.hs","Info.hs","Mem.hs","Timeout.hs",-"CPUTime","Console","Environment","IO","Mem","Posix"]+Network.HTTP.Directory> httpDirectory' "https://hackage.haskell.org/package/base/src/src/System"+["CPUTime.hsc","Environment.hs","Exit.hs","IO.hs","Info.hs","Mem.hs","Timeout.hs","CPUTime","Console","Environment","IO","Mem","Posix"] ``` See more [examples](https://github.com/juhp/http-directory/blob/main/example/) and the [latest haddock documentation](https://hackage.haskell.org/package/http-directory/docs/Network-HTTP-Directory.html) for more details.
http-directory.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: http-directory-version: 0.1.11+version: 0.1.12 synopsis: http directory listing library description: Library for listing the files (href's) in an http directory.
src/Network/HTTP/Directory.hs view
@@ -67,7 +67,7 @@ import Network.HTTP.Client.TLS (tlsManagerSettings) import Network.HTTP.Date (httpDateToUTC, parseHTTPDate) import qualified Network.HTTP.Simple as S-import Network.HTTP.Types (hContentLength, hLocation, hLastModified,+import Network.HTTP.Types (hAccept, hContentLength, hLocation, hLastModified, methodHead, statusCode, ResponseHeaders) import Network.URI (parseURI, URI(..)) @@ -128,7 +128,7 @@ -> IO [Text] httpRawDirectoryInternal httpreq url = do request <- parseRequest url- response <- httpreq request+ response <- httpreq $ S.addRequestHeader hAccept "text/html" request checkResponse url response let body = responseBody response doc = parseLBS body@@ -325,7 +325,9 @@ parseRequestHead :: String -> IO Request parseRequestHead url = do request <- parseRequest url- return $ request {method = methodHead}+ return $+ S.addRequestHeader hAccept "*/*" $+ request {method = methodHead} httpHead :: Manager -> String -> IO (Response ()) httpHead mgr url = do
test/Spec.hs view
@@ -113,7 +113,11 @@ describe "httpFileSizeTime" $ do it "haskell" $ do- (msize, mtime) <- httpFileSizeTime' "https://www.haskell.org/"+ (msize, mtime) <- httpFileSizeTime' "https://haskell.org/"+ (isJust msize, isJust mtime) `shouldBe` (False,True)++ it "hf" $ do+ (msize, mtime) <- httpFileSizeTime' "https://haskell.foundation/" (isJust msize, isJust mtime) `shouldBe` (True,True) -- https://github.com/postmanlabs/httpbin/issues/617