aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris2015-09-02 17:26:39 +0200
committerJoris2015-09-02 17:26:39 +0200
commitc17f89ef439a0b2e5a4511d8cdd55b2cfeb671b9 (patch)
tree8ce4f5dbd1b631b9ad9c4ec456179f484323a377
parenta45cffb45e751275b30f558109c21d8c6507e07d (diff)
Accept english language in request
-rw-r--r--README.md1
-rw-r--r--src/HTTP.hs3
2 files changed, 3 insertions, 1 deletions
diff --git a/README.md b/README.md
index c847c52..fcd32de 100644
--- a/README.md
+++ b/README.md
@@ -9,4 +9,5 @@ cabal sandbox init
cabal install --only-dependencies
npm install
npm run build
+./run lemon cocoa
```
diff --git a/src/HTTP.hs b/src/HTTP.hs
index 8d8d34a..1876410 100644
--- a/src/HTTP.hs
+++ b/src/HTTP.hs
@@ -11,6 +11,7 @@ import qualified Data.Text as T
import qualified Data.Text.IO as T
import Network.HTTP (simpleHTTP, getRequest, getResponseBody)
+import Network.HTTP.Headers (insertHeader, HeaderName(HdrAcceptLanguage))
import Model.URL
@@ -21,4 +22,4 @@ getPage url =
left (T.pack . show) <$> (try (unsafeGetPage url) :: IO (Either SomeException Text))
unsafeGetPage :: URL -> IO Text
-unsafeGetPage url = simpleHTTP (getRequest (T.unpack url)) >>= (\x -> T.pack . decodeString <$> getResponseBody x)
+unsafeGetPage url = simpleHTTP (insertHeader HdrAcceptLanguage "en" $ getRequest (T.unpack url)) >>= (\x -> T.pack . decodeString <$> getResponseBody x)