-
Notifications
You must be signed in to change notification settings - Fork 147
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
forces request query param values to be escaped #162
base: master
Are you sure you want to change the base?
Conversation
lib/api_auth/headers.rb
Outdated
parsed_uri = URI.parse(uri) | ||
|
||
return parsed_uri.request_uri if parsed_uri.respond_to?(:request_uri) | ||
uri_without_host = uri.gsub(URI_WITHOUT_HOST_REGEXP, '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is URI_WITHOUT_HOST_REGEXP ?
lib/api_auth/headers.rb
Outdated
uri.empty? ? '/' : uri | ||
# Different version of request parsers escape/unescape the param values | ||
# This will force param values to escaped | ||
def escape_params(uri) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is untest and very difficult to understand.
udpates params parsing function and adds tests Corrects error in merge udpates specs
a06e2f5
to
ddfa903
Compare
@fwininger I am sorry about that - I had a local helper which I did not include. Please see the new PR code attached which includes several new specs for testing. Note: I had to add Rails as a gemspec dependency since ActiveResource requires it. I am happy to make any changes you see fit, I am just trying to solve a issue affecting multiple people. |
end | ||
|
||
it 'does not change request url (by removing host)' do | ||
expect(request.url).to eq(uri) | ||
end | ||
end | ||
|
||
if RUBY_VERSION.to_f > 2.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest-client will throw an exception for an invalid URI in ruby versions 2.1 and below, I needed this so that all the CI tests would pass. I believe, in later versions the URI is properly escaped rather than throwing the exception but I did not verify in the rest-client code.
@fwininger any additional thoughts? |
This PR fixes issue #123 where query strings are handled differently based on combinations of different libraries.