lib/messenger/web.rb in messenger-0.3.5 vs lib/messenger/web.rb in messenger-0.3.6
- old
+ new
@@ -14,10 +14,10 @@
#
# The body of the message is posted as the body of the request, not the query.
def self.deliver(url, body, options={})
raise Messenger::URLError, "The URL provided is invalid" unless valid_url?(url)
method = options.delete(:method) || :post
- response = HTTParty.send(method, url, options.merge(:body => body))
+ response = HTTParty.send(method, url, options.merge(:body => body, :basic_auth => {:username => URI.parse(url).user, :password => URI.parse(url).password}))
Messenger::Result.new(success?(response), response)
end
def self.obfuscate(url)
raise Messenger::URLError, "The URL provided is invalid" unless valid_url?(url)