Skip to content

Instantly share code, notes, and snippets.

@crazymykl
Last active October 13, 2016 14:43
Show Gist options
  • Save crazymykl/3463ceddf89986b46821933b1bc0a11a to your computer and use it in GitHub Desktop.
Save crazymykl/3463ceddf89986b46821933b1bc0a11a to your computer and use it in GitHub Desktop.
SSCCE for elm-lang/http#4
module Main exposing (..)
import Html exposing (program, text, Html)
import Json.Decode exposing (succeed)
import Http
type alias Model =
Int
type Msg
= Thingy (Result Http.Error String)
main : Program Never Model Msg
main =
program { init = init, view = view, update = update, subscriptions = always Sub.none }
init : ( Model, Cmd Msg )
init =
0 ! [ post ]
view : Model -> Html Msg
view model =
text ""
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
model ! []
post : Cmd Msg
post =
let
body =
Http.multipartBody [ Http.stringPart "foo" "bar" ]
in
Http.send Thingy (Http.post "https://slack.com/api/rtm.start" body (succeed ""))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment