2

While using the rspec-api-documentation gem in markdown mode (config.format = [:markdown]) I noticed that the documentation generated is lacking the response body.

Is there a permanent fix for this?

Viktor
  • 2,623
  • 3
  • 19
  • 28

1 Answers1

7

The problem is documented in this issue and there does not seem to be a permanent fix at the moment. A workaround has been posted in the issues comment and it involves monkey-patching:

module RspecApiDocumentation
  class RackTestClient < ClientBase
    def response_body
      last_response.body.encode("utf-8")
    end
  end
end

Adding the code in the initializer (rspec_api_docs.rb) before generating the documentation seems to solve the issue.

Viktor
  • 2,623
  • 3
  • 19
  • 28