chore: test http-conduit and basic http request
This commit is contained in:
parent
52a0ce91f4
commit
f7e229f503
3 changed files with 18 additions and 4 deletions
|
@ -23,7 +23,7 @@
|
||||||
(final: prev: {
|
(final: prev: {
|
||||||
suntheme = final.haskell-nix.project' {
|
suntheme = final.haskell-nix.project' {
|
||||||
src = ./.;
|
src = ./.;
|
||||||
compiler-nix-name = "ghc982";
|
compiler-nix-name = "ghc966";
|
||||||
shell.tools = {
|
shell.tools = {
|
||||||
cabal = {};
|
cabal = {};
|
||||||
hlint = {};
|
hlint = {};
|
||||||
|
|
|
@ -29,8 +29,9 @@ executable newsance
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
main-is: Main.hs
|
main-is: Main.hs
|
||||||
build-depends:
|
build-depends:
|
||||||
base >=4.2 && <5,
|
base ^>=4.18.2.1,
|
||||||
http-client ^>=0.7.17,
|
bytestring ^>=0.12.1.0,
|
||||||
|
http-conduit ^>=2.3.8.3,
|
||||||
|
|
||||||
if flag(threaded)
|
if flag(threaded)
|
||||||
ghc-options: -threaded
|
ghc-options: -threaded
|
||||||
|
|
15
src/Main.hs
15
src/Main.hs
|
@ -1,3 +1,16 @@
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
module Main (main) where
|
module Main (main) where
|
||||||
|
|
||||||
main = putStrLn "Hello, World!"
|
import qualified Data.ByteString.Lazy.Char8 as L8
|
||||||
|
import Network.HTTP.Simple
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
response <- httpLBS "https://git.youwen.dev/youwen5/newsance.rss"
|
||||||
|
|
||||||
|
putStrLn $
|
||||||
|
"The status code was: "
|
||||||
|
++ show (getResponseStatusCode response)
|
||||||
|
print $ getResponseHeader "Content-Type" response
|
||||||
|
L8.putStrLn $ getResponseBody response
|
||||||
|
|
Loading…
Reference in a new issue