denibertovic/docker-hs — pull request #1 by irekjozwiak (2014-12-16 16:24:11+00:00)
Title: changed Content-Type of post queries to application/json

The problem solved by this commit is that previously, the query would yield an error:

StatusCodeException (Status {statusCode = 500, statusMessage = "Internal Server Error"}) [("Content-Type","text/plain; charset=utf-8"),("Date","Tue, 16 Dec 2014 14:48:42 GMT"),("Content-Length","77"),("X-Response-Body-Start","Content-Type specified (application/octet-stream) must be 'application/json'\n"),("X-Request-URL","POST http://x.x.x.x:2375/v1.14/containers/create")] (CJ {expose = []})

Technically, this is because if you use "encode" then Wreq decides that the Content-Type will be "application/octet-stream". Using toJSON instead yields a Value, which tells Wreq to use "application/json" Content-Type. This resolves the issue.

Tested against DockerVersion {_Version = "1.3.3", _GitCommit = "5dc1c5a", _GoVersion = "go1.3.2", _Arch = "amd64", _KernelVersi|on = "3.17.2"}