rubymotion/BubbleWrap — pull request #109 by dmarkow (2012-07-18 23:28:17+00:00)
Title: Format option for setting Content-Type

From the discussion in #108, this adds support for a `format` parameter, and sets reasonable default content types when neither a content type nor a format is provided.

For now, the format parameter is only used to decide on a Content-Type header. However, it could be used in the future to set accept headers, automatically manipulate payloads (e.g. `format: :json` might result in the payload being converted to a JSON string before sending), etc.

Formats provided are:
* `text` (text/plain)
* `json` (application/json)
* `xml` (application/xml)
* `form_data` (multipart/form-data)
* `form_encoded` (application/x-www-form-urlencoded)

When a format is not provided, the default is `form_encoded`. However, if there is a hash-based payload or files to upload, it defaults to `form_data` instead.