-
Notifications
You must be signed in to change notification settings - Fork 526
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
RUBY-1768 change to_s to return original URI #2596
Conversation
I think a bigger question here is what will happen if the original URI was partially invalid and the invalid parts were dropped during parsing. If you do decide to return |
Also what happens for SRV URIs? |
@p-mongo that's a good point, I learned that options with invalid values should be dropped (when srvMaxHosts is negative, for example), so I decided to reconstruct the uri from its parts. I have added tests for regular URIs and srv URIs. |
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 do you think about having ability to retrieve both the original uri and the "correct" uri? And designated methods for this, e.g. to_uri
and original_uri
. The "URI" in class name makes this confusing because technically URI is the string, a URI parsed into components is strictly no longer a URI.
spec/mongo/uri/srv_protocol_spec.rb
Outdated
end | ||
end | ||
|
||
context 'read preference max staleness option provided' do | ||
|
||
let(:options) do | ||
'readPreference=Secondary&maxStalenessSeconds=120' | ||
'readPreference=secondary&maxStalenessSeconds=120' |
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.
Does this lowercasing behavior have a test?
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.
I'm going to put this back as well
lib/mongo/uri.rb
Outdated
end | ||
|
||
private | ||
|
||
# Reconstruct the URI from its parts. |
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.
So this should say that invalid option values are dropped and option names are converted to lower|canonical case.
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.
done
3f671f9
to
bc5c991
Compare
@p-mongo this is rfal |
No description provided.