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

Integer parameters in URLs don't work #1023

Closed
ebroder opened this issue Dec 9, 2015 · 1 comment
Closed

Integer parameters in URLs don't work #1023

ebroder opened this issue Dec 9, 2015 · 1 comment

Comments

@ebroder
Copy link

ebroder commented Dec 9, 2015

...or at least, I think that's what's going on.

The "Version" parameter for GetTrafficPolicy is encoded in the URL (the path is /2013-04-01/trafficpolicy/{Id}/{Version}). However, Version is specified to be an integer. It seems like any version number I pass in gets coerced to an integer, which in turn causes an exception when the REST handlers attempt to escape the version before interpolating it into the URL.

This appears to happen regardless of whether I pass a string or an integer for the version parameter:

evan@caron:~$ pry
[1] pry(main)> require 'aws-sdk-core'
=> true
[2] pry(main)> r53 = Aws::Route53::Client.new
=> #<Aws::Route53::Client>
[3] pry(main)> r53.get_traffic_policy(id: 'c9819c64-2dda-4fb0-919a-0c1bdb5c198e', version: 1)
NoMethodError: undefined method `encode' for 1:Fixnum
from /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/seahorse/util.rb:24:in `uri_escape'
[4] pry(main)> wtf?!?
Exception: NoMethodError: undefined method `encode' for 1:Fixnum
--
 0: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/seahorse/util.rb:24:in `uri_escape'
 1: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/aws-sdk-core/rest/request/endpoint.rb:110:in `escape'
 2: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/aws-sdk-core/rest/request/endpoint.rb:43:in `param_value_for_placeholder'
 3: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/aws-sdk-core/rest/request/endpoint.rb:35:in `block in apply_path_params'
 4: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/aws-sdk-core/rest/request/endpoint.rb:34:in `gsub'
 5: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/aws-sdk-core/rest/request/endpoint.rb:34:in `apply_path_params'
 6: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/aws-sdk-core/rest/request/endpoint.rb:25:in `uri'
 7: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/aws-sdk-core/rest/request/builder.rb:23:in `populate_endpoint'
 8: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/aws-sdk-core/rest/request/builder.rb:8:in `apply'
 9: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/aws-sdk-core/rest/handler.rb:6:in `call'
10: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/aws-sdk-core/plugins/user_agent.rb:12:in `call'
11: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/seahorse/client/plugins/endpoint.rb:41:in `call'
12: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/aws-sdk-core/plugins/route_53_id_fix.rb:20:in `call'
13: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/aws-sdk-core/plugins/param_validator.rb:21:in `call'
14: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/seahorse/client/plugins/raise_response_errors.rb:14:in `call'
15: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/aws-sdk-core/plugins/param_converter.rb:20:in `call'
16: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/seahorse/client/plugins/response_target.rb:21:in `call'
17: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/seahorse/client/request.rb:70:in `send_request'
18: /home/evan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.2.5/lib/seahorse/client/base.rb:207:in `block (2 levels) in define_operation_methods'
@trevorrowe
Copy link
Member

Thanks for reporting the issue and providing all of the context. Your hunch was correct. I've pushed a fix and added a test to prevent regressions. Thanks!

I hope to release this fix shortly.

awood45 added a commit that referenced this issue Dec 16, 2015
@srchase srchase added the bug label Dec 24, 2018
@awood45 awood45 added the v2 label Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants