Last active
October 13, 2016 14:43
-
-
Save crazymykl/3463ceddf89986b46821933b1bc0a11a to your computer and use it in GitHub Desktop.
SSCCE for elm-lang/http#4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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