I want to download the content of the URL
http://example.com/foobar?key1=value1&key2=value2
using http-conduit (GET request).
How can I do that:
a) Assuming I already know the full (i.e. encoded URL) b) If some parameters are dynamic and therefore not URL-encoded?
Note: This question was answered Q&A-style and therefore intentionally does not show any research effort.
Regarding a):
You can use
simpleHttp
with an URL containing query parameters just like the example in the docs:Regarding b):
You need a list of key/value tuples of type
[(ByteString, Maybe ByteString)]
that contains your query parameters.Note: This requires at least http-conduit 2.1. Also note that it is recommended to reuse
Manager
instances where applicable.