ymtszw/elm-http-xml/1.0.2

NOTE: the latest version is 2.0.0

Http.Xml

Generates HTTP request for XML API.

Using Xml.Decode for decoding XML response into Elm value.

Request Builders

request : String -> List Header -> String -> Body -> Decoder a -> Request a

Create a request to URL that returns XML. Adding Accept: application/xml header.

It tries to decode XML response to Elm value.

import Http
import Xml.Decode exposing (single, string)


getXml : Request String
getXml =
    request "GET" [] "https://example.com/xml" Http.emptyBody (single string)
get : String -> Decoder a -> Request a

Create a GET request.

post : String -> Body -> Decoder a -> Request a

Create a POST request.

put : String -> Body -> Decoder a -> Request a

Create a PUT request.

patch : String -> Body -> Decoder a -> Request a

Create a PATCH request.

Request Body

xmlBody : String -> Body

Put an XML string in the body. Adding Content-type: application/xml header.

Response Expectation

expectXml : Decoder a -> Expect a

Expect the response body to be XML.

You provide Xml.Decode.Decoder to decode that XML into Elm value.