You can use `Http.send` with a custom request object to set arbitrary 
headers.

Here's an example that send an application/json POST request.

judgeImage : Judgement -> Image -> Cmd Msg
judgeImage judgement image =
  let
    url = "http://localhost:3000/id/"; ++ (toString image.id) ++ "/judge"
    body = 
      case judgement of
        Keep -> Http.string "KEEP"
        Delete -> Http.string "DELETE"
        Fave -> Http.string "FAVE"
    request : Http.Request
    request = 
      { verb = "POST"
      , headers = [ ("Content-Type", "application/json") ]
      , url = url
      , body = body
      }
  in
    Task.perform
        JudgeFail
        (\_ -> JudgeSucceed judgement image)
        (Http.send Http.defaultSettings request)

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to