How to add support for posting multipart forms to the Play Scala WS library

For Process Street‘s Yammer integration, I needed to post file attachments to their API using the Play Scala WS library.

However, it turns out that WS does not yet support uploading files using multipart/form-data and POST. There are several workarounds on the ‘net, but they all involve getting the underlying Ning Java client and doing thing manually.

Why not harness the power of Play and Scala and write our own Writeable to do that job? Heck, we already have a MultipartFormData object for handling multipart form requests, why not use that?

Behold, the fruit of my labour:

Now, how do you use it? Like so:

No Comment

No comments yet

Leave a reply

*