Skip to content
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

Do not mutate strings passed as config options, fixes #461 #537

Merged
merged 1 commit into from
Apr 5, 2017
Merged
Show file tree
Hide file tree
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
10 changes: 7 additions & 3 deletions app/controllers/apipie/apipies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@ def authorized_doc

def get_format
[:resource, :method, :version].each do |par|
if params[par]
params[:format] = :html unless params[par].sub!('.html', '').nil?
params[:format] = :json unless params[par].sub!('.json', '').nil?
next unless params[par]
[:html, :json].each do |format|
extension = ".#{format}"
if params[par].include?(extension)
params[par] = params[par].sub(extension, '')
params[:format] = format
end
end
end
request.format = params[:format] if params[:format]
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/initializers/apipie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# can be overriden in resource_description
# by default is it 1.0 if not specified anywhere
# this must be defined before api_base_url and app_info
config.default_version = "development"
config.default_version = "development".freeze

config.doc_base_url = "/apidoc"

Expand Down