zipmark/rspec_api_documentation — pull request #106 by benjie (2014-01-10 10:02:56+00:00)
Title: Allow documenting multipart/form-data submissions

If you upload binary files via `multipart/form-data` then rspec-api-documentation would crash out with encoding errors from `JSON.pretty_generate` (see below). But really you wouldn't want to document the raw file data anyway; so this patch truncates the request body output and update the curl command to support `multipart/form-data` using curl's `-F` switch.

I've been programming Ruby for less than a month and I don't know how best to develop gems so any pointers on things I should have done with this would be appreciated.

```
* Upload PNG avatar
~/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/json/common.rb:278:in `encode': "\xFF" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/json/common.rb:278:in `generate'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/json/common.rb:278:in `pretty_generate'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec_api_documentation-2.0.0/lib/rspec_api_documentation/writers/formatter.rb:7:in `to_json'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec_api_documentation-2.0.0/lib/rspec_api_documentation/writers/json_writer.rb:27:in `block (2 levels) in write'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec_api_documentation-2.0.0/lib/rspec_api_documentation/writers/json_writer.rb:26:in `open'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec_api_documentation-2.0.0/lib/rspec_api_documentation/writers/json_writer.rb:26:in `block in write'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec_api_documentation-2.0.0/lib/rspec_api_documentation/writers/json_writer.rb:23:in `each'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec_api_documentation-2.0.0/lib/rspec_api_documentation/writers/json_writer.rb:23:in `write'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec_api_documentation-2.0.0/lib/rspec_api_documentation/writers/json_writer.rb:16:in `write'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec_api_documentation-2.0.0/lib/rspec_api_documentation/api_documentation.rb:28:in `block in write'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec_api_documentation-2.0.0/lib/rspec_api_documentation/api_documentation.rb:27:in `each'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec_api_documentation-2.0.0/lib/rspec_api_documentation/api_documentation.rb:27:in `write'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec_api_documentation-2.0.0/lib/rspec_api_documentation/api_formatter.rb:42:in `each'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec_api_documentation-2.0.0/lib/rspec_api_documentation/api_formatter.rb:42:in `stop'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/reporter.rb:127:in `block in notify'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/reporter.rb:126:in `each'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/reporter.rb:126:in `notify'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/reporter.rb:122:in `stop'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/reporter.rb:106:in `finish'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/reporter.rb:60:in `report'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:25:in `run'
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:80:in `run'
```