From 43df35213e80b9b7de69cc80f138882708a05b9b Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 18 Oct 2016 16:37:15 +0200 Subject: Improving all forms --- app/controllers/xrd_controller.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/xrd_controller.rb b/app/controllers/xrd_controller.rb index 159a954b3..003ffc182 100644 --- a/app/controllers/xrd_controller.rb +++ b/app/controllers/xrd_controller.rb @@ -1,5 +1,6 @@ class XrdController < ApplicationController - before_action :set_default_format + before_action :set_default_format_json, only: :webfinger + before_action :set_default_format_xml, only: :host_meta def host_meta @webfinger_template = "#{webfinger_url}?resource={uri}" @@ -24,7 +25,11 @@ class XrdController < ApplicationController private - def set_default_format + def set_default_format_xml + request.format = 'xml' if request.headers["HTTP_ACCEPT"].nil? && params[:format].nil? + end + + def set_default_format_json request.format = 'json' if request.headers["HTTP_ACCEPT"].nil? && params[:format].nil? end -- cgit