mwunsch / weary

A framework and DSL for building RESTful web service clients
MIT License
480 stars 23 forks source link

Basic Authentication Failure #13

Closed mariochavez closed 12 years ago

mariochavez commented 12 years ago

Hi;

I'm trying to use basic auth, this is the way that I'm doing it - this code belongs to a class:

get :my_method, '/some/url/{param}' do |resource|
  resource.basic_auth!
end

Then I'm calling my method like - c is the instance of my class -:

r = c.my_method(:param => 'Hi', :username => 'user', :password => 'password').perform
r.body

I got: ArgumentError: wrong number of arguments (3 for 2) from /Users/marioch/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/weary-1.0.0/lib/weary/middleware/basic_auth.rb:6:in `initialize'

Looking at basic_auth.rb file, a * is missing on credentials parameter, initialize method should be like:

def initialize(app, *credentials)

After adding *, Weary is working just fine.

adelevie commented 12 years ago

Can you send a pull request since you've fixed it?

mariochavez commented 12 years ago

Is there any chance to get this merge and release a new gem?, this is a show stopper to me.

mwunsch commented 12 years ago

mariochavez: will take a look asap (sorry, was out of town for a bit)

mwunsch commented 12 years ago

This pull request was merged. Going to cut 1.0.1 soon