square/mimecraft — pull request #3 by mlc (2013-05-29 21:23:11+00:00)
Title: change getHeaders() to return a Map

It's very inconvenient for getHeaders() to return a List if you want to use the result anywhere (like with an HttpURLConnection); you have to parse out the colons and whatnot.

This patch therefore changes the signature of getHeaders() to return a `Map` and adjusts the implementation and tests appropriately.

Obviously this is a backwards-incompatible change. I don't know if there are any current users of Mimecraft or in particular its getHeaders() method to disappoint, but if there are, it would of course be a problem.

On the other hand, I'm prepared to argue that there almost certainly can not be (m)any such users, because [there's a bug][l18] in the current FormEncoding.java where the returned "header" is in fact just a MIME type without the "Content-Type: " bit. This sort of bug becomes impossible (or at least markedly more difficult) to create when returning a Map.

[l18]: https://github.com/square/mimecraft/blob/d31894e788cf48556a47d09ca0d96f2c84f894d4/src/main/java/com/squareup/mimecraft/FormEncoding.java#L18