我試圖創建一個Http.Request值:缺少Http.Request的參數是什麼?
request : Http.Request
request =
{ verb = "POST"
, headers =
[ ("Origin", "http://elm-lang.org")
, ("Access-Control-Request-Method", "POST")
, ("Access-Control-Request-Headers", "X-Custom-Header")
]
, url = url
, body = body
}
的代碼被嵌入在下面的功能:
tryRegister : Form -> (Result Http.Error JsonProfile -> msg) -> Cmd msg
tryRegister form msg =
let
url =
baseUrl ++ "register"
body =
encodeRegistration form |> Http.jsonBody
request : Http.Request
request =
{ verb = "POST"
, headers =
[ ("Origin", "http://elm-lang.org")
, ("Access-Control-Request-Method", "POST")
, ("Access-Control-Request-Headers", "X-Custom-Header")
]
, url = url
, body = body
}
in
Http.send msg request
我收到以下錯誤:
Type Http.Request has too few arguments. - Expecting 1, but got 0.
Http.Request缺少什麼論點?
附錄:
http://package.elm-lang.org/packages/evancz/elm-http/3.0.1/Http