aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2025-09-08 15:49:05 +0200
committerJohn MacFarlane <[email protected]>2025-09-09 10:51:04 +0200
commit4b126bd90b72d03b8697151f4e055f588430fc2b (patch)
tree6ce5bc7269312359b541e536a942239b5e3db834 /src
parent47e1cc46c67e937f7202d98de1d9bdd857f7b454 (diff)
PandocMonad: Let fetching fail if the HTTP request is not successful.
HTTP requests that don't return a 200 error code are now treated as an error. This ensures that a warning is triggered when using `--embed-resources` or `--extract-media`.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Class/IO.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Class/IO.hs b/src/Text/Pandoc/Class/IO.hs
index de76bdc76..49de2c436 100644
--- a/src/Text/Pandoc/Class/IO.hs
+++ b/src/Text/Pandoc/Class/IO.hs
@@ -46,7 +46,7 @@ import qualified Network.TLS as TLS
import qualified Network.TLS.Extra as TLS
import Network.HTTP.Client
(httpLbs, Manager, responseBody, responseHeaders,
- Request(port, host, requestHeaders), parseRequest, newManager)
+ Request(port, host, requestHeaders), parseUrlThrow, newManager)
import Network.HTTP.Client.Internal (addProxy)
import Network.HTTP.Client.TLS (mkManagerSettings)
import Network.HTTP.Types.Header ( hContentType )
@@ -168,9 +168,9 @@ openURL u
proxy <- tryIOError (getEnv "http_proxy")
let addProxy' x = case proxy of
Left _ -> return x
- Right pr -> parseRequest pr >>= \r ->
+ Right pr -> parseUrlThrow pr >>= \r ->
return (addProxy (host r) (port r) x)
- req <- parseRequest (unpack u) >>= addProxy'
+ req <- parseUrlThrow (unpack u) >>= addProxy'
let req' = req{requestHeaders = customHeaders ++ requestHeaders req}
resp <- httpLbs req' manager
return (B.concat $ toChunks $ responseBody resp,