Minor cleanups.

Also, use json.NewEncoder instead. It generates less garbage, especially in Go tip (after 1.1).

And trust the Content-Length detection. It works.
Merge pull request #281 from bradfitz/master

Minor Go cleanups