我正在尝试使用自定义标头创建 http 请求(使用 http-conduit-1.9.4):
req <- parse "https://some_url"
let request = req { requestHeaders = [customHeader] }
而且我不明白什么应该是customHeader?我努力了
import Network.HTTP.Headers
let custom_header = mkHeader (HdrCustom "Some-Header") "Some-Value"
但是发生了错误
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]}
我也试过了
let custom_header = ("Some-Header", "Some-Value")
和错误
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
那么,有人知道customHeader应该是什么吗?