]> git.openstreetmap.org Git - rails.git/blobdiff - test/test_helper.rb
Merge remote-tracking branch 'upstream/pull/2605'
[rails.git] / test / test_helper.rb
index a5ea127f6b44785dac44cb67e4530431addaa51c..1a60c8234bc33b5abc6b00e7282b8746faee7e48 100644 (file)
@@ -118,6 +118,12 @@ module ActiveSupport
       @request.env["HTTP_AUTHORIZATION"] = format("Basic %{auth}", :auth => Base64.encode64("#{user}:#{pass}"))
     end
 
+    ##
+    # return request header for HTTP Basic Authorization
+    def basic_authorization_header(user, pass)
+      { "Authorization" => format("Basic %{auth}", :auth => Base64.encode64("#{user}:#{pass}")) }
+    end
+
     ##
     # set request header for HTTP Accept
     def http_accept_format(format)
@@ -130,6 +136,10 @@ module ActiveSupport
       @request.env["HTTP_X_ERROR_FORMAT"] = format
     end
 
+    def error_format_header(f)
+      { "X-Error-Format" => f }
+    end
+
     ##
     # Used to check that the error header and the forbidden responses are given
     # when the owner of the changset has their data not marked as public