Skip to content

Update endpoint.rb #156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 31, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions lib/rspec_api_documentation/dsl/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,21 @@ def do_request(extra_params = {})
if method == :get && !query_string.blank?
path_or_query += "?#{query_string}"
else
formatter = RspecApiDocumentation.configuration.post_body_formatter
case formatter
when :json
params_or_body = params.to_json
when :xml
params_or_body = params.to_xml
when Proc
params_or_body = formatter.call(params)
if respond_to?(:raw_post)
params_or_body = raw_post
else
params_or_body = params
formatter = RspecApiDocumentation.configuration.post_body_formatter
case formatter
when :json
params_or_body = params.to_json
when :xml
params_or_body = params.to_xml
when Proc
params_or_body = formatter.call(params)
else
params_or_body = params
end
end

params_or_body = respond_to?(:raw_post) ? raw_post : params_or_body
end

rspec_api_documentation_client.send(method, path_or_query, params_or_body, headers)
Expand Down