diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3922d74e..3fcc7e3c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,7 +19,7 @@ jobs: stack: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - run: stack dot --global-hints --resolver nightly --lock-file read-write - uses: actions/cache@v4 with: @@ -47,14 +47,27 @@ jobs: - '9.12' include: - os: macos-latest - ghc: system + ghc: '9.12' - os: windows-latest - ghc: system + ghc: '9.12' steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: hspec/setup-haskell@v1 with: ghc-version: ${{ matrix.ghc }} - uses: sol/run-haskell-tests@v2 with: caching: true + + success: + needs: build + runs-on: ubuntu-latest + if: always() # this is required as GitHub considers "skipped" jobs as "passed" when checking branch protection rules + + steps: + - run: false + if: needs.build.result != 'success' + + - uses: actions/checkout@v6 + - name: Check for trailing whitespace + run: '! git grep -I "\s\+$"' diff --git a/README.md b/README.md index 949d060e..e34c6778 100644 --- a/README.md +++ b/README.md @@ -11,5 +11,5 @@ Please check out the [tutorial](TUTORIAL.md). Due to Haddock pulling the documentation directly from http-client, some "Since" notations give the version numbers of the http-client package. For reference, -http-client-0.5.0 corresponds to http-conduit-2.2.0, and +http-client-0.5.0 corresponds to http-conduit-2.2.0, and http-client-0.4.30 corresponds to http-conduit-2.1.11 . diff --git a/TUTORIAL.md b/TUTORIAL.md index 27a19474..6e3c1635 100644 --- a/TUTORIAL.md +++ b/TUTORIAL.md @@ -13,7 +13,7 @@ The API documentation can be found at: ## Tutorial exercise -To help motivate learning, keep in mind the following exercise while reading through the tutorial, +To help motivate learning, keep in mind the following exercise while reading through the tutorial, and try to implement a solution. Write a program that takes an input file with one URL per line, and ensures that making a request to each URL returns a non-error status code. diff --git a/http-client-tls/test/Spec.hs b/http-client-tls/test/Spec.hs index 010a8c3d..d5b0a0d6 100644 --- a/http-client-tls/test/Spec.hs +++ b/http-client-tls/test/Spec.hs @@ -25,7 +25,7 @@ main = hspec $ do it "make a TLS connection" $ do manager <- newManager tlsManagerSettings - withResponse "https://httpbin.org/status/418" manager $ \res -> + withResponse "https://httpcan.org/status/418" manager $ \res -> responseStatus res `shouldBe` status418 it "digest authentication" $ do @@ -33,14 +33,14 @@ main = hspec $ do req <- join $ applyDigestAuth "user" "passwd" - "http://httpbin.org/digest-auth/qop/user/passwd" + "http://httpcan.org/digest-auth/auth/user/passwd" man response <- httpNoBody req man responseStatus response `shouldBe` status200 it "incorrect digest authentication" $ do man <- newManager defaultManagerSettings - join (applyDigestAuth "user" "passwd" "http://httpbin.org/" man) + join (applyDigestAuth "user" "passwd" "http://httpcan.org/" man) `shouldThrow` \(DigestAuthException _ _ det) -> det == UnexpectedStatusCode @@ -82,6 +82,6 @@ main = hspec $ do it "global supports TLS" $ do manager <- getGlobalManager - request <- parseRequest "https://httpbin.org" + request <- parseRequest "https://httpcan.org" response <- httpNoBody request manager responseStatus response `shouldBe` status200 diff --git a/http-client/test-nonet/Network/HTTP/Client/RequestSpec.hs b/http-client/test-nonet/Network/HTTP/Client/RequestSpec.hs index 2b3fc8b4..638889d8 100644 --- a/http-client/test-nonet/Network/HTTP/Client/RequestSpec.hs +++ b/http-client/test-nonet/Network/HTTP/Client/RequestSpec.hs @@ -158,4 +158,3 @@ spec = do case xs of (x:xs') -> (xs', x) [] -> ([], "") - diff --git a/http-client/test/Network/HTTP/ClientSpec.hs b/http-client/test/Network/HTTP/ClientSpec.hs index 368cbc5a..93b1aaf0 100644 --- a/http-client/test/Network/HTTP/ClientSpec.hs +++ b/http-client/test/Network/HTTP/ClientSpec.hs @@ -19,14 +19,14 @@ main = hspec spec spec :: Spec spec = describe "Client" $ do it "works" $ do - req <- parseUrlThrow "http://httpbin.org/" + req <- parseUrlThrow "http://httpcan.org/" man <- newManager defaultManagerSettings res <- httpLbs req man responseStatus res `shouldBe` status200 -- Test the failure condition described in https://github.com/snoyberg/http-client/issues/489 it "keeps connection alive long enough" $ do - req <- parseUrlThrow "http://httpbin.org/" + req <- parseUrlThrow "http://httpcan.org/" man <- newManager defaultManagerSettings res <- responseOpen req man responseStatus res `shouldBe` status200 @@ -51,39 +51,39 @@ spec = describe "Client" $ do describe "method in URL" $ do it "success" $ do - req <- parseUrlThrow "POST http://httpbin.org/post" + req <- parseUrlThrow "POST http://httpcan.org/post" man <- newManager defaultManagerSettings res <- httpLbs req man responseStatus res `shouldBe` status200 it "failure" $ do - req <- parseRequest "PUT http://httpbin.org/post" + req <- parseRequest "PUT http://httpcan.org/post" man <- newManager defaultManagerSettings res <- httpLbs req man responseStatus res `shouldBe` status405 describe "bearer auth" $ do it "success" $ do - initialReq <- parseUrlThrow "http://httpbin.org/bearer" + initialReq <- parseUrlThrow "http://httpcan.org/bearer" let finalReq = applyBearerAuth "token" initialReq man <- newManager defaultManagerSettings res <- httpLbs finalReq man responseStatus res `shouldBe` status200 it "failure" $ do - req <- parseRequest "http://httpbin.org/bearer" + req <- parseRequest "http://httpcan.org/bearer" man <- newManager defaultManagerSettings res <- httpLbs req man responseStatus res `shouldBe` status401 describe "redirects" $ do xit "follows redirects" $ do - req <- parseRequest "http://httpbin.org/redirect-to?url=http://httpbin.org" + req <- parseRequest "http://httpcan.org/redirect-to?url=http://httpcan.org" man <- newManager defaultManagerSettings res <- httpLbs req man responseStatus res `shouldBe` status200 xit "allows to disable redirect following" $ do req <- (\ r -> r{ redirectCount = 0 }) <$> - parseRequest "http://httpbin.org/redirect-to?url=http://httpbin.org" + parseRequest "http://httpcan.org/redirect-to?url=http://httpcan.org" man <- newManager defaultManagerSettings res <- httpLbs req man responseStatus res `shouldBe` found302 @@ -99,7 +99,7 @@ spec = describe "Client" $ do } settings = defaultManagerSettings { managerModifyResponse = modify } man <- newManager settings - res <- httpLbs "http://httpbin.org" man + res <- httpLbs "http://httpcan.org" man (statusCode.responseStatus) res `shouldBe` 201 it "modifies the response body" $ do @@ -111,7 +111,7 @@ spec = describe "Client" $ do } settings = defaultManagerSettings { managerModifyResponse = modify } man <- newManager settings - res <- httpLbs "http://httpbin.org" man + res <- httpLbs "http://httpcan.org" man responseBody res `shouldBe` "modified response body" context "managerModifyRequest" $ do @@ -119,20 +119,20 @@ spec = describe "Client" $ do let modify req = return req { port = 80 } settings = defaultManagerSettings { managerModifyRequest = modify } man <- newManager settings - res <- httpLbs "http://httpbin.org:1234" man + res <- httpLbs "http://httpcan.org:1234" man responseStatus res `shouldBe` status200 it "checkResponse" $ do let modify req = return req { checkResponse = \_ _ -> error "some exception" } settings = defaultManagerSettings { managerModifyRequest = modify } man <- newManager settings - httpLbs "http://httpbin.org" man `shouldThrow` anyException + httpLbs "http://httpcan.org" man `shouldThrow` anyException xit "redirectCount" $ do let modify req = return req { redirectCount = 0 } settings = defaultManagerSettings { managerModifyRequest = modify } man <- newManager settings - response <- httpLbs "http://httpbin.org/redirect-to?url=foo" man + response <- httpLbs "http://httpcan.org/redirect-to?url=foo" man responseStatus response `shouldBe` found302 -- skipped because CI doesn't have working IPv6 diff --git a/http-conduit/http-conduit.cabal b/http-conduit/http-conduit.cabal index 2601626a..83078b8d 100644 --- a/http-conduit/http-conduit.cabal +++ b/http-conduit/http-conduit.cabal @@ -58,7 +58,7 @@ test-suite test type: exitcode-stdio-1.0 hs-source-dirs: test - ghc-options: -Wall + ghc-options: -Wall -threaded cpp-options: -DDEBUG build-depends: base >= 4 && < 5 , HUnit @@ -68,7 +68,7 @@ test-suite test , warp-tls , tls < 1.5 || >= 1.5.2 , time - , time-manager < 0.3 + , time-manager , blaze-builder , bytestring , text @@ -77,7 +77,7 @@ test-suite test , utf8-string , case-insensitive , unliftio - , wai >= 3.0 && < 3.3 + , wai >= 3.0 , warp >= 3.0.0.2 , wai-conduit , http-types