-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fix URL override not being used for API calls #126
Fix URL override not being used for API calls #126
Conversation
cc @Fryguy There appear to be two ways to do this in an OpenAPI generated gem. You can either provide The latter seems like the "nicer" way to do it, only downside seems to be that the scheme can't be overridden. |
3152bde
to
2742924
Compare
We had some existing specs which tested a |
verify_ssl = OpenSSL::SSL::VERIFY_PEER if verify_ssl.nil? | ||
verify_ssl = verify_ssl == OpenSSL::SSL::VERIFY_PEER | ||
|
||
IntersightClient::ApiClient.new( | ||
IntersightClient::Configuration.new do |config| | ||
config.scheme = scheme | ||
config.host = host | ||
if url && url != "https://intersight.com" |
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.
String comparison of the URL has me slightly concerned, only because someone could also put "https://intersight.com/"
(trailing slash), and that should technically go through here too - I wonder if there's way to parse the URL object anyway, then check if url.hostname == "intersight.com"
?
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.
Yeah a bunch of edge cases here, if someone sets url=http://intersight.com:1234/some-other-base-path
I'm not sure that we would want to default to https://intersight.com
which is what would happen there.
Can certainly check each component of the URI though the code is going to get a little gross though :D
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.
Maybe URI::Generic#==
can rescue us here
>> URI.parse('https://intersight.com') == URI.parse('https://intersight.com:443/')
=> true
2742924
to
e122027
Compare
The openapi generated `ApiClient`/`Configuration` classes have a way to to pass scheme, host, and base_path but `Configuration#server_settings` is used unless `Configuration#server_index` is set to `nil`.
e122027
to
6d8e4f0
Compare
Backported to
|
…ing_used Fix URL override not being used for API calls (cherry picked from commit d25a318)
The openapi generated
ApiClient
/Configuration
classes have a way to to pass scheme, host, and base_path but they are ignored andConfiguration#server_settings
is used unless server_index is set tonil