Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure that header exists before accessing it #149

Merged
merged 1 commit into from
Jun 26, 2015

Conversation

swelther
Copy link

I use this gem through the savon gem. In my project I noticed a small bug:

If the first (savon) call fails (e.g. because of a typo in the WSDL URL) the next call to the same savon object crashes with this callstack:

undefined method `include?' for nil:NilClass
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/httpi-2.4.0/lib/httpi/adapter/net_http.rb:103:in `negotiate_ntlm_auth'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/httpi-2.4.0/lib/httpi/adapter/net_http.rb:80:in `block in do_request'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/httpi-2.4.0/lib/httpi/adapter/net_http.rb:79:in `do_request'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/httpi-2.4.0/lib/httpi/adapter/net_http.rb:34:in `request'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/httpi-2.4.0/lib/httpi.rb:160:in `request'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/httpi-2.4.0/lib/httpi.rb:126:in `get'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/wasabi-3.5.0/lib/wasabi/resolver.rb:43:in `load_from_remote'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/wasabi-3.5.0/lib/wasabi/resolver.rb:33:in `resolve'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/wasabi-3.5.0/lib/wasabi/document.rb:142:in `xml'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/wasabi-3.5.0/lib/wasabi/document.rb:160:in `parse'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/wasabi-3.5.0/lib/wasabi/document.rb:147:in `parser'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/wasabi-3.5.0/lib/wasabi/document.rb:64:in `soap_actions'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/savon-2.11.1/lib/savon/operation.rb:23:in `ensure_exists!'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/savon-2.11.1/lib/savon/operation.rb:15:in `create'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/savon-2.11.1/lib/savon/client.rb:32:in `operation'
/home/swelther/.rvm/gems/ruby-2.0.0-p451/gems/savon-2.11.1/lib/savon/client.rb:36:in `call'

This PR adds a check if the header is really present and resolves my bug from above.

@rogerleite
Copy link
Member

Hi @swelther! Thanks for this PR! #148 seems to be the same scenario.

rogerleite added a commit that referenced this pull request Jun 26, 2015
Ensure that header exists before accessing it
@rogerleite rogerleite merged commit 59eb83b into savonrb:master Jun 26, 2015
@swelther
Copy link
Author

It's worth a try, let's see what the issue creator says :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants