scotty-web/scotty — pull request #139 by jgegenfurtner (2014-12-12 19:14:05+00:00)
Title: Added XML request and response support.

This adds 'xml' and 'xmlData' mirroring 'json' and 'jsonData' to scotty.
Unfortunately, this also introduces a dependency on xml-conduit.
You might ask who uses XML for REST nowadays anyway. That is a good point,
but should scotty ever want XML support, here it is.

I also added a minimalistic example on XML consumption and production.

---

This is how the example plays out:

### Valid XML body:
`$ curl -X POST -d 'world' http://localhost:3000/xmlecho`

```world```

### Invalid XML body:
`$ curl -X POST -d 'world' http://localhost:3000/xmlecho`

```

500 Internal Server Error

xmlData - no parse: 1:13-1:22: Expected end element for: Name {nameLocalName = "hello", nameNamespace = Nothing, namePrefix = Nothing}, but received: EventEndElement (Name {nameLocalName = "broken", nameNamespace = Nothing, namePrefix = Nothing}). Data was:world```

### Server Log:
>POST /xmlecho
Params: [("`world`","")]
Accept: `*/*`
consuming body
Status: 200 OK 0.000101s
POST /xmlecho
Params: [("`world`","")]
Accept: `*/*`
consuming body
Status: 500 Internal Server Error 0.000155s