This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AuthRequestHelper | |
def http_auth_as(username, password, &block) | |
@env = {} unless @env | |
old_auth = @env['HTTP_AUTHORIZATION'] | |
@env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(username, password) | |
yield block | |
@env['HTTP_AUTHORIZATION'] = old_auth | |
end | |
def auth_get(url, params={}, env={}) |