about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-18 16:37:15 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-18 16:37:15 +0200
commit43df35213e80b9b7de69cc80f138882708a05b9b (patch)
treed3b70597b5172f0daf2b95e6cd4a48a7bc6d7b56 /app/controllers
parent6f7c9774c776afeea0d98cbbd30483f4f0c6b938 (diff)
Improving all forms
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/xrd_controller.rb9
1 files changed, 7 insertions, 2 deletions
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