Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Net::HTTPHeader#basic_auth

(::String account, ::String password) -> void
basic_auth(account, password)

Sets header 'Authorization' using the given account and password strings:

Example
req.basic_auth('my_account', 'my_password')
req['Authorization']
# => "Basic bXlfYWNjb3VudDpteV9wYXNzd29yZA=="
See also #add_field #canonical_each #[]= #chunked? also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0