-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip url-encoding #53
Comments
Then you want to have a query flag. If so, add it by using |
Thanks Mark, but since I'm still a novice to Haskell after 4 years of spastic education, could you just write down a snippet? The initial line goes like bs <- req GET (https "mysite.net" /: "en" /: "hippos" /: "search?show_type=all") |
Here is a complete example that fetches the page as a strict {-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import Control.Monad.IO.Class
import Data.Aeson
import Data.Default.Class
import Data.Text (Text)
import Network.HTTP.Req
main :: IO ()
main = runReq def $ do
r <- req GET
(https "mysite.net" /: "en" /: "hippos" /: "search")
NoReqBody
bsResponse
("show_type" =: ("all" :: Text))
liftIO $ print (responseBody r) |
Thanks, it works. [Does not connected with question itself] Maybe I'm missing something in my Haskell odyssey. |
It's not my fault!
I don't see why this would be the case,
Well you can put it without disassembling. see: https://hackage.haskell.org/package/req-1.2.1/docs/Network-HTTP-Req.html#v:parseUrlHttps ...and similar. Although it's not as safe. Your URL could be malformed for example. Or what if you need to assemble it from different components that change dynamically? In that case you probably going to appreciate API of the library.
General programming is different from code golf IMO. It doesn't matter much if it's 2 lines or 5 lines. What matters is correctness. |
How can I skip url-encoding? For example, I'd like to keep question sign in "search?show_type".
PS. Thanks for great Hachikell (as they say in Moscow) library!
The text was updated successfully, but these errors were encountered: