Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am lehresman on github.
  • I am lehresman (https://keybase.io/lehresman) on keybase.
  • I have a public key ASDSI9g-Zg9ztUVzIGBZjHuCaSbNHV8n6B60jDhppRchTAo

To claim this, I am signing this object:

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={})