servant-elm-0.3.0.0: test/elm-sources/postBooksSource.elm
module PostBooksSource exposing (..)
import Http
postBooks : Book -> Http.Request (NoContent)
postBooks body =
Http.request
{ method =
"POST"
, headers =
[]
, url =
String.join "/"
[ ""
, "books"
]
, body =
Http.jsonBody (encodeBook body)
, expect =
Http.expectStringResponse
(\{ body } ->
if String.isEmpty body then
Ok NoContent
else
Err "Expected the response body to be empty"
)
, timeout =
Nothing
, withCredentials =
False
}