I'm trying to create http request with custom header (with http-conduit-1.9.4 usage):
req <- parse "https://some_url"
let request = req { requestHeaders = [customHeader] }
And I don't understant what should be customHeader? I have tried
import Network.HTTP.Headers
let custom_header = mkHeader (HdrCustom "Some-Header") "Some-Value"
but an error occured
Couldn't match expected type `Network.HTTP.Types.Header.Header'
with actual type `Header'
In the expression: custom_header
In the `requestHeaders' field of a record
In the expression: req {requestHeaders = [custom_header]}
also I have tried just
let custom_header = ("Some-Header", "Some-Value")
and error
Couldn't match expected type `Network.HTTP.Types.Header.HeaderName'
with actual type `[Char]'
In the expression: "User-Agent"
In the expression: ("User-Agent", "erthalion")
In the `requestHeaders' field of a record
So, anybody knows what should be customHeader?
http-conduit does not use the HTTP package at all, they are two different approaches entirely. If you look in the http-types documentation, you'll see that a Header
is just a tuple of header name and value.
The only reason your custom_header
didn't work is because you need to turn on the OverloadedStrings
language extension.