instance method
Net::HTTPHeader#basic_auth
(::String account, ::String password) -> void
basic_auth(account, password)
lib/net/http/header.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/net/http/header.rb, line 949
def basic_auth(account, password)
@header['authorization'] = [basic_encode(account, password)]
end
Sets header 'Authorization' using the given account and password strings:
Example
req.basic_auth('my_account', 'my_password') req['Authorization'] # => "Basic bXlfYWNjb3VudDpteV9wYXNzd29yZA=="